- Git
- Python >=3.6
- Flask
- Yarn (optional)
- NPM (optional)
- Go to https://www.python.org/downloads/ and download the latest version of Python with pip for your OS.
- Go to https://git-scm.org and install the latest version of git
First, Create a fork of this repo
Then, Clone the forked repo
git clone "https://github.com/your_username_/Project_Name.git" restapi
cd restapi/api
Install the required dependencies and Start the flask server
pip install -r requirements.txt
set FLASK_ENV=development
flask run
Slides are available here
- Use this website to check the functionality of your API
- Write the 5 HTTP methods in
api/app.py
- get(“/”) - returns a key-value pair, with key "message" and value "Welcome to OSAI" *TIP: Refer to slide 14
- get(“/events”) - returns events currently stored in the API
- post(“/events”) - Adds an event to the end of the events dictionary stored in the API
*
request.json
contains the data you add in the form * puts the data into a new key-value pair in events * returns the index in string format - patch(“/events/<event_id>”) * Updates the event for the given id
- delete(“/events/<event_id>”) * takes in 1 argument called event_id of int type * deletes the key-value pair with the id passed in * returns a "Deletion Successful" message