- Python
- MongoDB
- FLASK
http://mozcctuapi.herokuapp.com/status
Follow the steps for working on this repository strictly :
- Fork the repository to your Github account
- Copy the link (ends with a .git) of your forked repository
- In a folder of your choice in your local machine, run
git clone thelinkyoujustcopied.git
cd mcctezu_backend
git remote add upstream https://github.com/adiXcodr/mcctezu_backend.git
- When ever you want to push your change, do
git add .
andgit commit -m "did a change"
and then dogit pull upstream master
. Then finally, dogit push origin master
. - After pushing, go to your forked repository on Github and create a pull request.
-
cd mcctezu_backend
-
pip install -r requirements.txt
(only for the first time) thenpython app.py
-
To manipulate/view tables(collections) do
python handle_tables.py
-
Add or Edit the routes and functions in the file run_model.py
- Locally, eg: http://localhost:9999/run-model/add_members
- With LIVE Heroku Server, eg: https://mcctezu-backend.herokuapp.com/run-model/add_members
- Test the API with POSTMAN.
Example for FETCH NOTIFICATIONS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/get_members
to get all the members. - Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/get_members/<_id>
to get a member for an ID.
Example Input for add_members and edit members (ALL FIELDS MUST BE SENT):
{
"_id": 1,
"name": "Adittya Dey",
"dept": "CSE",
"linkedin": "somelink",
"phone": "somenumber",
"email": "someemail",
"image": "somelink",
"interest": "Full Stack"
}
Example Input for delete members (Send ID):
{
"_id": 1
}
Example for GET EVENTS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/get_events
ORhttps://mcctezu-backend.herokuapp.com/run-model/get_events/
to get all the records. - Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/get_events/<event_name>
to get record for specified event only.
Example input for ADD EVENTS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/add_events
INPUT:
{
"evt_name":"Codeathon",
"evt_org":"MCC_TEZU",
"evt_date":"04/09/2020",
"evt_time":"3:00pm",
"evt_venue":"Dean's Building",
"evt_image":"none"
}
Example input for UPDATE EVENTS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/update_events
INPUT:
{
"field": {
"evt_name": "Code Hack"
},
"field_update": {
"evt_org": "MCC_TEZU"
}
}
In field
attribute give the column name to identify the record to update. In field_update
specify the column to be updated and give the new value to it.
Example input for DELETE EVENTS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/delete_events
INPUT:
{
"evt_name":"Codathon"
}
Specify the column to identify and delete the record.
Example input for ADD NOTIFICATIONS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/notifications/add
INPUT:
{
"_id":3,
"date":"27/04/2020",
"title":"Events",
"notification":"sample text"
}
Example for FETCH NOTIFICATIONS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/notifications/fetch
ORhttps://mcctezu-backend.herokuapp.com/run-model/notifications/fetch/
to get all the records. - Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/notifications/fetch/<_id>
to get record for specified notification by id.
Example input for UPDATE NOTIFICATIONS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/notifications/update
to Update Single Record
INPUT:
{
"_id": 3,
"title": "NEW TITLE"
}
In field
attribute give the column name to identify the record to update. In update
specify the column to be updated and give the new value to it.
Example input for DELETE NOTIFICATIONS :
- Set the URL TO
https://mcctezu-backend.herokuapp.com/run-model/notifications/delete_one
to Delete Single Record OR Set the URL TOhttps://mcctezu-backend.herokuapp.com/run-model/notifications/delete_many
to Delete More Than One Records INPUT:
{
"_id": 3
}