Summary

In this chapter, we understood the difference between synchronous and asynchronous execution. We created a new version of the RESTful API that takes advantage of the non-blocking features in Tornado, combined with an asynchronous execution. We improved the scalability of our existing API and made it possible to start executing other requests while waiting for slow I/O operations with sensors and actuators. We avoided splitting our methods into multiple methods with callbacks by using the tornado.gen generator-based interface that Tornado provides, to make it easier to work in an asynchronous environment.

Then, we set up a testing environment. We installed pytest, along with many plugins, to make it easy to discover and execute unit tests. We wrote the first round of unit tests, measured test coverage, and then wrote additional unit tests to improve that test coverage. We created all the necessary tests to have coverage of a nice amount of lines of code.

We built RESTful web services with Django, Flask, Pyramid, and Tornado. We chose the most appropriate framework for each case. We learned how to design a RESTful API from scratch, and to run all the necessary tests to make sure that our API works without issues as we release new versions. We learned that we could encapsulate RESTful APIs in microservices and deploy them to the dozens of available modern cloud platforms. Now, we are ready to create RESTful APIs with any of the web frameworks with which we have been working throughout this book.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.187.233