Making a Places to Visit app using Python and Flutter: Part 2
Making the API.
Welcome to part 2 of the creation of the ‘Tembea Kenya’ application :)
I will be using the Flask framework to create a simple API that would allow the application to communicate and fetch data from the database.
The API will process requests and return data for each category and will additionally return data on general category details i.e the category name and the number of requests in each category.
To enable lazy loading of the data in the application, limit and offset are introduced in the API. The offset specifies the number of rows that are skipped for each data request and the limit specifies the number of records fetched for each request.
A jsonified request is returned for each request indicating the status code and the data returned.
The full code can be seen here below or here:
Some observations i made during this task:
- Node JS would also have been a better option for the API creation.
Next: Creating the application using flutter