Creating a Flaks REST API to learn new concepts about it This is a simple API that you can do a full CRUD of name,views and likes for video
-
GET method, /videos/int:videoid , get the data of video if exists
-
PUT method, /videos/int:videoid , with the json of your video {"name":"example","views":integer,"likes":integer}
-
PATCH method, /videos/int:videoid , with the json of your video {"name":"example","views":integer,"likes":integer} in this method you dont need to pass all parameters it will only changes what you put
-
DELETE method, /videos/int:videoid , delete the video if exists
you can see methods examples in the tests.py file
- First create an venv for the application
- $ python3 -m venv venv
- Clone the application
- $ git clone https://github.com/Petreon/Flask_RESTAPI.git
- Install the dependencies
- $ pip3 install -r requirements.txt
- Start the enviroment
- $ source venv/bin/activate
- Start the server
- $ python3 main.py
attention: if you want to deploy it, turn off the debug mode