# 📊 Number Classifier API
## 🚀 Overview
The **Number Classifier API** is a simple RESTful API that takes a number as input and returns interesting mathematical properties about it, including whether it is **prime**, **perfect**, **Armstrong**, and whether it is **even or odd**. Additionally, it fetches a **fun fact** about the number from the Numbers API.
---
## 📌 Features
✅ Classifies numbers as **odd** or **even**
✅ Checks if a number is **prime**
✅ Checks if a number is **perfect**
✅ Checks if a number is an **Armstrong number**
✅ Calculates the **sum of its digits**
✅ Fetches a **fun fact** about the number from the [Numbers API](http://numbersapi.com/)
✅ **CORS-enabled** for cross-origin requests
✅ Returns **JSON responses**
---
## 🛠️ Technology Stack
- **Node.js** (JavaScript runtime)
- **Express.js** (Lightweight web framework)
- **Axios** (For making API requests)
- **CORS** (To allow cross-origin requests)
- **Dotenv** (For managing environment variables)(I did'nt make use of this)
---
## 📥 Installation
### **1️⃣ Clone the Repository**
```sh
git clone https://github.com/Anthonyuketui/NumClassifier-api.git
cd NumClassifier-apinpm installnode server.jsThe server will start running at http://localhost:3000
GET /api/classify-number?number=<your_number>
GET http://localhost:3000/api/classify-number?number=371{
"number": 371,
"is_prime": false,
"is_perfect": false,
"properties": ["armstrong", "odd"],
"class_sum": 11,
"fun_fact": "371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371"
}{
"number": "alphabet",
"error": true
}- Push your code to GitHub
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/Anthonyuketui/NumClassifier-api.git
git push -u origin main
``- Install Vercel CLI
npm install -g vercel- Run Vercel Deployment
vercel- Follow the prompts, and get your public URL.
| Status Code | Description |
|---|---|
| 200 OK | Successfully processed the request |
| 400 Bad Request | Invalid or missing number parameter |
| 500 Internal Server Error | Unexpected server error |
This project is open-source and available under the MIT License.
Tony Uketui
🔗 GitHub: @Anthonyuketui
📧 Email: [Your Email]
Feel free to fork, open issues, or submit pull requests to improve this API! 🚀
---
### **📌 What This README Covers**
✅ **Project Overview**
✅ **Features**
✅ **Installation & Setup**
✅ **API Usage & Examples**
✅ **Deployment Guide (Render & Vercel)**
✅ **Error Handling & Status