Follow these steps to set up your environment for the project:
- Clone the GitHub Repository Locally: Begin by cloning the project's GitHub repository to your local machine.
- Create a Virtual Environment: Create a virtual environment to isolate project dependencies.
python -m venv venv
- Install Required Libraries: Install the necessary Python libraries by running the following command:
pip install -r requirements.txt
- Database Configuration: Modify the database settings in the
app/test.env
file to match your setup. - Initialize the Application: Start the application using Uvicorn with auto-reloading.
uvicorn app.main:app --reload
The application exposes the following endpoints:
- Test Endpoint (GET): A test endpoint to check if the application is running successfully.
URL: /
- Access All Posts (GET): Retrieve all posts from the database.
URL: /posts
- Create a New Post (POST): Add a new post to the database.
URL: /createposts
- Get a Specific Post (GET): Retrieve a specific post by its ID.
URL: /posts/{id}
- Delete a Specific Post (DELETE): Remove a specific post by its ID.
URL: /posts/{id}
- Update a Specific Post (PUT): Modify a specific post by its ID.
URL: /posts/{id}
The application is built using the following technologies:
- FastAPI: A modern, fast (high-performance) web framework for building APIs with Python.
- Pydantic: A data validation and parsing library.
- SQLAlchemy: A SQL toolkit and Object-Relational Mapping (ORM) for Python.
- Uvicorn: An ASGI server to run your FastAPI application.
- Postgres: A powerful, open-source relational database management system.