Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HNG Stage 0 - FastAPI Backend

A simple FastAPI application built for HNG Stage 0 task. This application provides basic API endpoints and demonstrates integration with external APIs.

Features

  • 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

Live Deployment

link

API Endpoints

GET /

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"
}

GET /me

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."
}

Prerequisites

  • Python 3.8+
  • pip (Python package manager)

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd HNG-backend/Stage0
  2. Create and activate a virtual environment:

    python -m venv venv
    .\venv\Scripts\activate  # On Windows
  3. Install dependencies:

    pip install -r requirements.txt

Running Locally

  1. Start the development server:

    uvicorn main:app --reload
  2. Open your browser and visit:

Deployment

This application is configured for deployment to AWS Lambda using Mangum.

AWS Lambda Deployment

  1. Package your application:

    pip install -r requirements.txt -t .
  2. Create a ZIP file with your application code and dependencies.

  3. Upload the ZIP file to AWS Lambda.

Environment Variables

No environment variables are required for basic functionality.

Testing

Run the test suite:

pytest

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages