Practice for API development and deployment using TDD
Built with:
- Python 3.6
- Flask
- Should have python 3.6 installed
- Should have
pip - Should have
virtualenv
-
Clone this repository.
-
Create a virtual environment for the project
virtualenv venv'venv' is the name of your folder. You can name it any way you please.
-
Install the requirements.txt
pip install -r requirements.txt -
Activate the virtual environment.
source venv/Scripts/activate-There should be your virtual environment folder in parentheses
(venv) -
Run DavePostAPI.py
python DavePostAPI.py -
Test the endpoints using Postman or using your browser at the endpoint /api/v1. This is where the documentation is located
POST api/v1/auth/register User registration. Should register user if the email is not already in use
POST api/v1/auth/login User login. Should login if credentials given are valid
GET api/v1/auth/logout User logout.
GET api/v1/posts View all posts.
GET api/v1/events/<int:post_id> View details of a single post
GET api/v1/users View all users.
GET api/v1/users/<int:user_id> View a single user.
GET api/v1/users/<int:user_id>/posts View all posts that belong to a single user.
POST api/v1/users/<int:user_id>/posts User can add a post.
DELETE api/v1/users/<int:user_id>/posts User can batch delete all their posts.
GET api/v1/users/<int:user_id>/posts/<int:post_id> View single post via this user.
PATCH api/v1/users/<int:user_id>/posts/<int:post_id> User can modify this post.
DELETE api/v1/users/<int:user_id>/posts/<int:post_id> User can delete this post.