Here's a demo of JWT authentication implemented by Flask with usage of a relational database, offers RESTful endpoints for registration, authentication and modification of user.
- Prerequiste:
docker
anddocker-compose
already installed - Run
docker-compose build --no-cache
to build image - Run
docker-compose up
to run in container. Use-d
argument to run it in background
- Prerequiste:
pipenv
already installed, or convert the Pipfile intorequirements.txt
for usingvirtualenv
if you wish - Run
pipenv install
- Get in the virtual environment:
pipenv shell
Use flask
to view all CLI commands in virtual environment
Here are the endpoints implemented in application:
Endpoint Methods Rule
----------------- -------- --------------------------
api.auth_login POST /api/v1/auth/login
api.auth_register POST /api/v1/auth/register
api.auth_user GET, PUT /api/v1/auth/user
api.doc GET /api/v1/ui
api.root GET /api/v1/
api.specs GET /api/v1/swagger.json
restx_doc.static GET /swaggerui/<path:filename>
static GET /static/<path:filename>
By using flask-restx
, a swagger documentation is generated when application is launched.
Run the application by docker-compose up
or flask run
in virtual environment, then view the documentation at http://0.0.0.0:8000/api/v1/ui
.