This project implements a Blog API using FastAPI. It provides endpoints for managing blog posts and user authentication.
- Create, read, update, and delete blog posts.
- Get a list of all blog posts or retrieve a specific post by ID.
- Create and retrieve user information.
- User authentication using JSON Web Tokens (JWT).
-
Clone the repository:
git clone
-
Change to the project directory:
cd "change to the project directory"
-
Install the required dependencies using pip:
pip install -r requirements.txt
-
Run the FastAPI server:
uvicorn main:app --reload
-
Access the API documentation in your browser at http://localhost:8000/docs.
-
Use the available endpoints to interact with the API.
- GET /blogs: Get a list of all blog posts.
- GET /blogs/{blog_id}: Get a specific blog post by ID.
- POST /blogs: Create a new blog post.
- PUT /blogs/{blog_id}: Update an existing blog post.
- DELETE /blogs/{blog_id}: Delete a blog post.
- GET /users: Get a list of all users.
- GET /users/{user_id}: Get user information by ID.
- POST /users: Create a new user.
- POST /login: User login endpoint. Returns a JWT token upon successful authentication.