An api for Blog using FastAPI
Use Virtualenv and install the packages.
pip install -r requirements.txt
Go to the project dir and run the below line in the terminal.
uvicorn main:app --reload
- To get all blogs
[GET]
http://localhost:800/blog
Authorization : Bearer token
- to get a blog with id
[GET]
http://localhost:8000/blog/{blog_id}
Authorization : Bearer token
- To create a blog
[POST]
http://localhost:8000/blog
in request body pass in json
{
"title": "title of the blog",
"body": "body of the blog"
}
Authorization : Bearer token
- To delete a blog
[DELETE]
http://localhost:8000/blog/{blog_id}
Authorization : Bearer token
- To update a blog
[PUT]
http://localhost:8000/blog/{blog_id}
in request body pass in json
{
"title": "title of the blog",
"body": "body of the blog"
}
Authorization : Bearer token
- To retrieve access token
[POST]
http://localhost:8000/login
in form passs
username & password
- To create a user
[POST]
http://localhost:8000/user
Authorization : Bearer token
username = divanshu
password = divanshu