Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joshidivanshu/blog-backend-using-fastapi-jwt-authentication

A Blog app backend created using FastAPI. Can perform test queries on the provided link just replace http://localhost:8000/ with a website link mentioned below. You can perform this using Postman or curl
https://github.com/joshidivanshu/blog-backend-using-fastapi-jwt-authentication

alembic api asychronous backend fastapi jose-jwt jwt-authentication oauth2 python-3 sqlaclhemy sqlite3 webdevelopment

Last synced: about 2 months ago
JSON representation

A Blog app backend created using FastAPI. Can perform test queries on the provided link just replace http://localhost:8000/ with a website link mentioned below. You can perform this using Postman or curl

Awesome Lists containing this project

README

        

# Blog FastAPI & Jwt Authentication
An api for Blog using FastAPI

## Installing Requirements

Use Virtualenv and install the packages.
```
pip install -r requirements.txt
```
## Running the Project

Go to the project dir and run the below line in the terminal.

```
uvicorn main:app --reload
```

## Interacting with the API

1. To get all blogs
```
[GET]
http://localhost:800/blog
Authorization : Bearer token
```
2. to get a blog with id
```
[GET]
http://localhost:8000/blog/{blog_id}
Authorization : Bearer token
```
3. 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
```
4. To delete a blog
```
[DELETE]
http://localhost:8000/blog/{blog_id}
Authorization : Bearer token
```
5. 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
```
6. To retrieve access token
```
[POST]
http://localhost:8000/login
in form passs
username & password
```
7. To create a user
```
[POST]
http://localhost:8000/user
Authorization : Bearer token
```

### Default Username & Password

```
username = divanshu
password = divanshu
```