Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peplxx/postapi
The application provides basic CRUD functionalities for managing posts in a database.
https://github.com/peplxx/postapi
crud crud-application crud-sample fastapi python
Last synced: 14 days ago
JSON representation
The application provides basic CRUD functionalities for managing posts in a database.
- Host: GitHub
- URL: https://github.com/peplxx/postapi
- Owner: peplxx
- Created: 2024-02-10T18:45:49.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-10T20:24:38.000Z (11 months ago)
- Last Synced: 2024-02-11T20:28:32.940Z (11 months ago)
- Topics: crud, crud-application, crud-sample, fastapi, python
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## PostApi FastAPI Application
This repository contains a FastAPI application for managing posts in a database through a RESTful API.
### Setup
1. Clone the repository:
git clone
2. Install dependencies:
pip install -r requirements.txt
3. Create an env.env file at the root with the following format:
PASSWORD = 'password for database'...
5. Run the application:
uvicorn main:app --reload
### Features
1. Endpoints:
- GET /: Retrieves a simple message indicating the root of the API.
- GET /posts: Retrieves all posts from the database.
- GET /posts/{post_id:int}: Retrieves a post by its ID.
- DELETE /posts/{post_id:int}: Deletes a post by its ID.
- POST /posts: Creates a new post with data provided.
- PUT /posts/{post_id:int}: Updates an existing post with new data.2. Data Models:
- PostData: Data type for representing post information.
- Post: Represents a post entity in the database.3. Exceptions:
- PostNotExist: Custom exception raised when a post does not exist.4. Database Interaction:
- Uses SQLAlchemy for interacting with the database.
- SQLAlchemy session works over PostgresSQL connection.### Usage
- The application provides basic CRUD functionalities for managing posts in a database.
- Use appropriate HTTP methods to interact with the API endpoints.### Additional Information
- Ensure to handle the env.env file securely to protect sensitive database information.
- For detailed API documentation, access the application through a web browser or API client.Repository was created for FastApi practise.