Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jesse-maurice/number-classification-api
A RESTful API that analyzes numbers and returns their mathematical properties along with interesting facts.
https://github.com/jesse-maurice/number-classification-api
dockerfile fastapi pytest python uvicorn
Last synced: 7 days ago
JSON representation
A RESTful API that analyzes numbers and returns their mathematical properties along with interesting facts.
- Host: GitHub
- URL: https://github.com/jesse-maurice/number-classification-api
- Owner: jesse-maurice
- Created: 2025-02-02T17:28:48.000Z (9 days ago)
- Default Branch: master
- Last Pushed: 2025-02-02T20:16:09.000Z (9 days ago)
- Last Synced: 2025-02-02T20:24:39.010Z (9 days ago)
- Topics: dockerfile, fastapi, pytest, python, uvicorn
- Language: Python
- Homepage: https://num-class.vercel.app
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Number Classification API
A RESTful API that analyzes numbers and returns their mathematical properties along with interesting facts.
## Features
- Determines if a number is prime
- Determines if a number is perfect
- Identifies Armstrong numbers
- Calculates digit sum
- Provides odd/even classification
- Includes fun mathematical facts about numbers## API Endpoint
```
GET /api/classify-number?number=
```### Success Response (200 OK)
```json
{
"number": 371,
"is_prime": false,
"is_perfect": false,
"properties": ["armstrong", "odd"],
"digit_sum": 11,
"fun_fact": "371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371"
}
```### Error Response (400 Bad Request)
```json
{
"number": "alphabet",
"error": true
}
```## Installation
1. Clone the repository:
```bash
git clone https://github.com/jesse-maurice/number-classification-api
cd number-classification-api
```2. Install dependencies:
```bash
pip install -r requirements.txt
```3. Run the application:
```bash
uvicorn app.main:app --reload
```## Testing
Run the tests using pytest:
```bash
pytest
```## Requirements
- Python 3.8+
- FastAPI
- pytest
- requests## Deployment
The API is deployed at: http://18.134.206.25:8000/api/classify-number
## License
MIT License