-
Endpoint:
GET <live-proudction-url>/api/classify-number
-
Required Query Parameter:
number
- Query Parameter Type:
integer
- Query Parameter Type:
-
Example Request:
GET <live-proudction-url>/api/classify-number?number=371
-
Example Response
{ "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" }
-
Example Request:
GET <live-proudction-url>/api/classify-number?number=alphabet
-
Example Error Response for invalid input
{ "number": "alphabet", "error": true }
- Python 3.8+
-
Clone or fork the repo
git clone https://github.com/nanafox/number-classifier-api.git
-
Change directory into the repo
cd classify-number-api
-
Create a virtual environment environment
python3 -m venv .venv
-
Source the environment and install dependencies
source .venv/bin/activate pip install -r requirements.txt
-
Run the local server
fastapi dev
-
Access the interactive (Swagger) docs at
http:localhost:8000/api/swagger-docs
-
Access Documentation at
http://localhost:8000/api/docs