Skip to content

Anofff/HNG-PublicAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HNG-PublicAPI

FastAPI Public API for HNG12 Stage 0 Task

This repository contains a simple FastAPI-based public API that fulfills the HNG12 Stage 0 backend task requirements. The API provides basic information including the current UTC datetime, registered email address, and the GitHub repository URL.

Features

  • Provides the current UTC datetime in ISO 8601 format.
  • Returns registered email and GitHub repository URL.
  • Handles Cross-Origin Resource Sharing (CORS) with proper configuration.
  • Designed to be deployed on a publicly accessible endpoint.

API Endpoints

1. Root Endpoint

URL: /

Method: GET

Response Example:

{
  "email": "[email protected]",
  "current_datetime": "2025-01-30T09:30:00Z",
  "github_url": "https://github.com/Anofff/HNG12-PublicAPI"
}

Requirements

  • Programming Language/Framework: Python (FastAPI)
  • Deployment: Hosted on a publicly accessible platform (e.g., Render).
  • Version Control: Public GitHub repository.
  • Response Format: JSON.

Setup Instructions

1. Clone the Repository

Clone this repository to your local machine:

git clone https://github.com/Anofff/HNG12-PublicAPI.git
cd HNG12-PublicAPI

2. Install Dependencies

Ensure you have Python 3.8+ installed, then run:

pip install -r requirements.txt

3. Run the API Locally

Start the FastAPI server using Uvicorn:

uvicorn app:app --host 0.0.0.0 --port 8000

4. Access the API

  • Base URL: http://127.0.0.1:8000/
  • Swagger UI: http://127.0.0.1:8000/docs
  • You can access this API remotely at: HNG-PublicAPI

Documentation

API Specification

  • Endpoint: /
  • Method: GET
  • Response Format: JSON

Example Response

{
  "email": "[email protected]",
  "current_datetime": "2025-01-30T09:30:00Z",
  "github_url": "https://github.com/Anofff/HNG12-PublicAPI"
}

Additional Resources

For more details about HNG12 backend roles and hiring, visit:

Contact

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages