Skip to content

This is a simple API built with Next.js that classifies numbers and provides interesting mathematical properties along with a fun fact.

License

Notifications You must be signed in to change notification settings

abijay440/classify-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Number Classification API

This is a simple API built with Next.js that classifies numbers and provides interesting mathematical properties along with a fun fact.

Setup Instructions

  1. Clone the repository:
  git clone https://github.com/abijay440/classify-number.git
  cd your-repo
  1. Install dependencies:
  npm install 
  1. Run the development server:
  npm run dev

API Documentation

Endpoint:

GET /api/classify-number?number=371

Response Format:

  1. Success Response (200 OK)
{
  "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"
}
  1. Error Response (400 Bad Request)
{
  "number": "alphabet",
  "error": true
}

Example Usage:

curl http://localhost:3000/api/classify-number?number=371

Deployment

Deploy the API to a platform of your choice (e.g., Vercel, Heroku).

Example (Vercel):

  1. Install Vercel
npm install -g vercel
  1. Deploy the project:
vercel

Backlink

[Hire Node.js Developers] https://hng.tech/hire/nodejs-developers

About

This is a simple API built with Next.js that classifies numbers and provides interesting mathematical properties along with a fun fact.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published