Note: API Integration with React react-api-integration
pip install -r requirements.txt
From config.py configure datbase url, name, user and password
{
"db": {
"url" : "mongodb://localhost:27017/",
"name" :"db_name",
"user" :"",
"password" :""
}
}
In model update collection name and desire fields name and fields type. For example see todo model file
From model folder write your individual model and configure db collection name, fields name and fields type
In todo model update collection name, fields name and fields type
collection_name = 'todos' # collection name
fields = {
"title" : "string",
"body" : "string",
"created" : "datatime"
}
Update required fields, optional fields from todo model
create_required_fields = [] # example create_required_fields = ["title", "body"]
create_optional_fields = [] # example create_required_fields = ["created"]
update_required_fields = []
update_optional_fields = []
create_required_fields = ["title", "body"]
create_optional_fields = []
update_required_fields = ["title", "body"]
update_optional_fields = []
In Database insert, find , find_by_id, update and delete methods are generalize methods.
Those methods are call from model
insert
method store data to database after confirm validation from modelfind
method retries all data from mongo databasefind_by_id
method retries back a single search dataupdate
method store updated data to database with corresponding id- and
delete
method delete data from database with corresponding id
python app.py