A simple FastAPI application built for HNG Stage 0 task. This application provides basic API endpoints and demonstrates integration with external APIs.
- Root Endpoint: Welcome message and API documentation
- User Profile: Get user information with a random cat fact
- Automated Testing: GitHub Actions workflow for testing
- Deployment Ready: Configured for AWS Lambda with Mangum
Returns a welcome message and available endpoints.
Response:
{
"message": "Welcome to the HNG Stage 0 API!",
"endpoints": {
"/me": "Get user profile with a random cat fact"
},
"documentation": "/docs"
}Returns user profile information along with a random cat fact.
Response:
{
"status": "success",
"user": {
"email": "otitodrichukwu@gmail.com",
"name": "Otito Ogene",
"stack": "Python/FastAPI"
},
"timestamp": "2025-10-16T23:12:00.000000+00:00",
"fact": "A random cat fact will appear here."
}- Python 3.8+
- pip (Python package manager)
-
Clone the repository:
git clone <repository-url> cd HNG-backend/Stage0
-
Create and activate a virtual environment:
python -m venv venv .\venv\Scripts\activate # On Windows
-
Install dependencies:
pip install -r requirements.txt
-
Start the development server:
uvicorn main:app --reload
-
Open your browser and visit:
- API: http://localhost:8000
- Interactive API docs: http://localhost:8000/docs
This application is configured for deployment to AWS Lambda using Mangum.
-
Package your application:
pip install -r requirements.txt -t . -
Create a ZIP file with your application code and dependencies.
-
Upload the ZIP file to AWS Lambda.
No environment variables are required for basic functionality.
Run the test suite:
pytest- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.