A boilerplate of flask Restful API + MongoDB + Nginx + Docker
#Clone the project
git clone https://github.com/arielroque/flasker.git
#Enter in the folder
cd flasker
# Deploy
./deploy.sh
# Build
docker-compose up
# Build recreating the containers
#docker-compose up --build --force-recreate
#Go to mongodb container
docker exec -it mongodb bash
#Login with admin user
mongo -u mongodbuser -p cl3v3rP9ssw0rd
#Use the database
use flaskdb
#Add user to connect with flask container
db.createUser({user: 'flaskuser', pwd: 'f19skp9ssw0rd', roles: [{role: 'readWrite', db: 'flaskdb'}]})
exit
# Add a new user
curl -v -X POST -H "Content-Type: application/json" -d '{"name":"John Doe","email":"johndoe@example.com"}' localhost:80/user
# Get the users
curl -v localhost:80/user
# Get an user by id
curl -v localhost:80/user/<id>
# Update an user
curl -v -X PUT -H "Content-Type: application/json" -d '{"name":"John","email":"johndoe@example.com"}' localhost:80/user/<id>
# Delete an user
curl -v -X DELETE localhost:80/user/<id>
docker-compose down