Technologies Getting Started API Endpoints
A simple Node.js API using Express and MySQL to manage schools.
- Nodejs
- Express.js
- MySQL
- Postman
How to Run Project Locally
prerequisites necessary for running your project.
- Node.js
- MySQL
- NPM
How to clone your project
git clone https://github.com/yourusername/school-management-api.git
cd school-management-api
DB_HOST=your_database_host
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_NAME=school_management
PORT=3000
How to start your project
node app.js
Here you can list the main routes of your API, and what are their expected request bodies.
route | description |
---|---|
GET /api/listSchools?latitude=lat&longitude=lon | List schools sorted by distance |
POST /api/addSchooll | Add a new school[request details] |
RESPONSE
[
{
"id": 1,
"name": "Springfield Elementary",
"address": "742 Evergreen Terrace, Springfield",
"latitude": 39.78,
"longitude": -89.64,
"distance": 0.0
},
{
"id": 2,
"name": "Shelbyville High",
"address": "123 Main St, Shelbyville",
"latitude": 39.90,
"longitude": -89.70,
"distance": 12.3
}
]
REQUEST
{
"name": "Springfield Elementary",
"address": "742 Evergreen Terrace, Springfield",
"latitude": 39.78,
"longitude": -89.64
}
RESPONSE
{
"message": "School added successfully",
"schoolId": 1
}