This Turbo-Tale is a FastAPI-based web service designed to provide a backend for blog applications. It offers a range of functionalities including user authentication, creating, editing, and retrieving blog posts, and user management.
To run the API locally, follow these steps:
- Python 3.9
- pip (Python package manager)
-
Clone the Repository
git clone https://github.com/Addy-codes/TurboTale.git cd blog-api -
Set Up a Virtual Environment
- For Windows:
python -m venv my_venv .\my_venv\Scripts\activate - For Unix or MacOS:
python3 -m venv venv source venv/bin/activate
- For Windows:
-
Install Dependencies
pip install -r requirements.txt -
Environment Variables Create a
.envfile in the root directory and add the following:MONGO_USERNAME=your_username MONGO_PASSWORD=your_password -
Run the Application
uvicorn app.main:app --reloadThe API will be available at
http://localhost:8000. You can access the API documentation athttp://localhost:8000/docs.
To run the API using Docker Compose, follow these steps:
-
Build and Run with Docker Compose
docker-compose up -d --build -
Access the Application The API will be available at
http://localhost:8000, and you can visit the API documentation athttp://localhost:8000/docs.
The API is deployed on Render and can be accessed at https://turbotale.onrender.com/.
To test the API and view its documentation, visit https://turbotale.onrender.com/docs.
GET /- Description: Root endpoint that provides a welcome message.
-
POST /register- Description: Register a new user.
-
POST /login- Description: Authenticate a user and return a token.
-
POST /blog- Description: Create a new blog post.
-
GET /blogs- Description: Retrieve all blog posts with pagination.
- Query Parameters:
page_no: Page number (integer, greater than or equal to 1).records_per_page: Number of blog posts per page (integer, up to 100).
-
GET /blog/{blog_id}- Description: Retrieve a specific blog post by ID.
- Path Parameters:
blog_id: Blog post ID.
-
PATCH /blog/{blog_id}- Description: Update a specific blog post by ID.
- Path Parameters:
blog_id: Blog post ID.
-
DELETE /blog/{blog_id}- Description: Delete a specific blog post by ID.
- Path Parameters:
blog_id: Blog post ID.
-
GET /dashboard- Description: Retrieve blog posts that match the criteria of the current user.
- Query Parameters:
page_no: Page number (integer, greater than or equal to 1).records_per_page: Number of blog posts per page (integer, up to 100).
-
PUT /updateUser/- Description: Update user information.
-
PATCH /update-tags- Description: Update user's tags.

