This project is created to test Python + Flask + MongoDB following the next tutorial Flask Rest API - Zero to Yoda, but using structure of Blueprints insted of Flask-restful. MongoDB is managed by mongoengine.
This application has the following extensions:
- Flask:
pipenv install flask
- MongoEngine:
pipenv install flask-mongoengine
- Encrypt passwords (bcrypt):
pipenv install flask-bcrypt
- JWT for authentication:
pipenv instll flask-jwt-extended
pipenv shell
python app.py
-
Add a new user.
URL:http://localhost:5000/users
Method: POST
-
Sign in with the user created.
URL:http://localhost:5000/users/login
Method: POST
-
Get a list of users.
URL:http://localhost:5000/users
Method: GET
-
Add a new movie.
URL:http://localhost:5000/movies
Method: POST
Authorization: Bearer Token (add user Token).
-
Get a list of movies.
URL:http://localhost:5000/movies
Method: GET
Authorization: Bearer Token (add user Token).
-
Get a single movie.
URL:http://localhost:5000/movies/<id>
Method: GET
Authorization: Bearer Token (add user Token).
url_params:_id
-
Update a movie.
URL:http://localhost:5000/movies/<id>
Method: PUT
Authorization: Bearer Token (add user Token).
url_params:_id
-
Delete a movie.
URL:http://localhost:5000/movies/<id>
Method: DELETE
Authorization: Bearer Token (add user Token).
url_params:_id