Skip to content

Sample code of (Python) Flask that uses Mongo to store data. Entire project is containerized.

Notifications You must be signed in to change notification settings

torredefarol24/flask_mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SETUP & INSTALLATION

1. Build Image
make build
  1. Create Network
make init_network
  1. Start DB container
make db
  1. Start App container
make app

The app will start on

127.30.1.1:6161

  1. Stop DB & App
make stop

API DOCUMENTATION

  • Users

Get Users

curl --request GET \
  --url http://127.30.1.1:6161/api/v1/users

Get User By Id

curl --request GET \
  --url http://127.30.1.1:6161/api/v1/users/5f468aa4432c142b7e3bf6f1

Create User

curl --request POST \
  --url http://127.30.1.1:6161/api/v1/users \
  --header 'Content-Type: application/json' \
  --data '{
	"name" : "Michael Jay",
	"phone" : "3841",
	"age" : 19
}'

  • Medicine

Get Medicine

curl --request GET \
  --url http://127.30.1.1:6161/api/v1/medicines

Get Medicine By Id

curl --request GET \
  --url http://127.30.1.1:6161/api/v1/medicines/5f46b7a6a2b9b61d4647b270

Create Medicine

curl --request POST \
  --url http://127.30.1.1:6161/api/v1/medicines \
  --header 'Content-Type: application/json' \
  --data '{
	"name" : "Zinc",
	"group_name" : "Mineral",
	"med_type" : 0
}'


  • Dosage

Get Dosages

curl --request GET \
  --url http://127.30.1.1:6161/api/v1/dosages

Get Dosage By Id

curl --request GET \
  --url http://127.30.1.1:6161/api/v1/dosages/5f483211554108ecaaeef835

Create Dosage

curl --request POST \
  --url http://127.30.1.1:6161/api/v1/dosages \
  --header 'Content-Type: application/json' \
  --data '{
	"medicine" : "5f4842096e0bb4574f6b6a2b",
	"amount_bought" : 50,
	"frequency" : 2,
	"quantity" : 2
}'

Create Medicine & Dosage

curl --request POST \
  --url http://127.30.1.1:6161/api/v1.1/dosages \
  --header 'Content-Type: application/json' \
  --data '{
	"medicine": {
		"name": "Tusca",
		"group_name": "ChronBron",
		"med_type": 1
	},
	"amount_bought": 150,
	"frequency": 3,
	"quantity": 15
}'
  • Prescription

Get Prescriptions

curl --request GET \
  --url http://127.30.1.1:6161/api/v1/prescriptions

Get Prescription By Id

curl --request GET \
  --url http://127.30.1.1:6161/api/v1/prescriptions/5f483d037b00849f4ea065c6

Create Prescription

curl --request POST \
  --url http://127.30.1.1:6161/api/v1/prescriptions \
  --header 'Content-Type: application/json' \
  --data '{
	"user" : "5f4841da6e0bb4574f6b6a2a",
	"dosage" : "5f48438c7556a239f4fc9f54"
}'

Create Medicine, Dosage, Prescription

curl --request POST \
  --url http://127.30.1.1:6161/api/v1.1/prescriptions \
  --header 'Content-Type: application/json' \
  --data '{
	"user": "5f4841da6e0bb4574f6b6a2a",
	"medicine": {
		"name": "CalciumSSD",
		"group_name": "VitaminD",
		"med_type": 0
	},
	"amount_bought": 20,
	"frequency": 1,
	"quantity": 2
}'

About

Sample code of (Python) Flask that uses Mongo to store data. Entire project is containerized.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published