Skip to content

arielroque/flasker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flasker

A boilerplate of flask Restful API + MongoDB + Nginx + Docker

🔖 Requirements

🚩 Starting

#Clone the project
git clone https://github.com/arielroque/flasker.git
#Enter in the folder 
cd flasker

🏃 Tl;dr

# Deploy 
./deploy.sh

🏗️ For deployment

Build the Containers with Docker Compose

# Build
docker-compose up

# Build recreating the containers
#docker-compose up --build --force-recreate 

Configure the credenctials to conect Flask with Mongo database container

#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

🔬 Making Requests

# 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>

😕 Uninstall

docker-compose down

About

A boilerplate of flask Restful API + MongoDB + Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published