This project demonstrates simple CRUD (Create, Read, Update, Delete) operations using FastAPI.
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
This project showcases a basic API for managing posts. It includes endpoints for creating, retrieving, updating, and deleting posts.
-
Clone the repository:
git clone https://github.com/dev-Kevo/fastApi.git cd fastApi
-
Create a virtual Enviroment and activate:
python -m venv <name_of_the_virtual_env> cd venv/Scripts ----> activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the FastAPI application:
uvicorn app.main:app --reload
-
Open your browser and navigate to http://127.0.0.1:8000/docs to access the FastAPI Swagger documentation.
-
Explore and test the CRUD operations using the provided API endpoints.
- Endpoint:
/create
- Method:
POST
- Parameters:
title
,content
,published
- Endpoint:
/post/{id}
- Method:
GET
- Endpoint:
/posts
- Method:
GET
- Endpoint:
/update/{id}
- Method:
PUT
- Parameters:
id
,title
,content
,published
- Endpoint:
/delete/{id}
- Method:
DELETE
- Parameters:
id
- FastAPI: https://fastapi.tiangolo.com/
- Uvicorn: https://www.uvicorn.org/