Creating REST Web Services
Although Flask is a popular lightweight web framework, it can also support RESTful web service implementations. It has its own JSON encoders and decoders, built-in JSON support mechanisms for response generation and error handling, easy-to-manage RESTful request dispatching, and a lean configuration approach. Unlike the other API frameworks, Flask uses more modules and packages because of the required project structure it needs to maintain. However, after setting up the directory structure accordingly, the succeeding steps will be seamless, lightweight, and straightforward.
This chapter will introduce the part of the Flask framework that deals with building API endpoints to provide data and services to sub-modules or other applications. The goal is to understand how Flask manages the incoming requests and outgoing responses for REST endpoints that will run on its environment. Also, this chapter will discuss the various components that will comprise the...