This project features a basic minimal JSON API written in Python using the Flask package. You should use it to learn the fundamentals of creating an API in Python, or for that matter any API as it has the usual suspects.
- Returns a todo-style API with all the RESTFul routes
- Data is in memory and has no DB (you can set one up, ...I will add that later)
- Has basic authentication
- Has basic logging
- Setup with a reasonable amount of unit testing, you can easily do more
This is not a full fledged production API, nor is it perfect. You can learn from it and perfect it if you'd like
All routes return json even your base index or '/' route.
- GET
'/' - GET
'/todo/tasks' - GET
/'todo/tasks/<int:task_id>' - POST
'/todo/tasks' - PUT
/'todo/tasks/<int:task_id>' - DELETE
/'todo/tasks/<int:task_id>'
Use cURL, Postman, or Insomnia to play around with it
Using Python 3.6.1, you should use venv and could be compatible with 2.7.1
git clone- (venv)
pip install flask flask_httpauth logging flask runpython -m unittest discover
- Better app *patterns and *structure
- Add a DB, Flask is agnostic so you can use any DB you like. Try SQL Lite
- Add a login route and improve authentication
- Improve tests for more coverage, add coverage package (via pip).
- Add Swagger
- Improve the logger
- Alter the API, do something fun and deploy it