Skip to content

Blog post REST API built using FasAPI allows users to register, login, create, edit, delete posts, and view other users post.

Notifications You must be signed in to change notification settings

iamvigneshwars/blog-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog REST API

Supported Python versions Package version

Blog REST API built using FastAPI with CRUD functionalities allows users to register, create, read, update, and read posts. All the blog posts are saved in a postgres database. The API requires authentication for delete and update operations.

API Endpoints:

Live Endpoints

Config

To connect to a postgres database, create a .env file in the root directory and add the following,

DATABASE_HOSTNAME=<HOSTNAME>
DATABASE_PORT=<PORT NUMBER>
DATABASE_PASSWORD=<PASSWORD>
DATABASE_NAME=<NAME>
DATABASE_USERNAME=<USERNAME>

To hash the user passwords, add the following to the .env file

SECRET_KEY=<KEY>
ALGORITHM=<HASING ALGORITHM>
ACCESS_TOKEN_EXPIRE_MINUTES=<EXPIRE MINUTES>

Usage

To start the server, run the following command

uvicorn app.main:app

// during development

uvicorn app.main:app --reload

Create a new user:

Login:

Login endpoint takes inputs as form-data. Copy the authentication token to create, edit, or delete a post.

Create Post:

User the access token as Authentication header to create a post.

Update Post:

To update a post, use the access token and the path parameter to specify the post ID.

Delete Post:

To Delete a post, use the access token and the path parameter to specify the post ID to be deleted.

Requirements

About

Blog post REST API built using FasAPI allows users to register, login, create, edit, delete posts, and view other users post.

Topics

Resources

Stars

Watchers

Forks

Languages