API LINK: https://apis-student.onrender.com
This is a Student REST API built using Node.js and ExpressJS. It provides the following features:
- Add a student
- Delete a student
- Search for a student by admission ID
- Search for a student by name
- Update a student's details using admission number
- Node.js
- NPM
- Clone the repository
- Run npm install to install the dependencies
- Rename .env.example file to .env and set the database URL as per your requirement.
Run the following command to start the server:
npm start
The server will start running on http://localhost:3000
.
To add a student, send a POST request to /students
with the following JSON data:
{
"name": "John Doe",
"course":"MCA",
"deptName":"Dept of Computer Science",
"phoneNumber": "1234567890"
}
To add a student, send a PUT request to /students/:admissionNumber
with the following JSON data:
{
"name": "John Doe",
"course":"MCA",
"deptName":"Dept of Computer Science",
"mobileNo": "1234567890"
}
To delete a student, send a DELETE request to /students/:admissionNumber
, where :admissionNumber
is the admission number of the student to be deleted.
To search for a student by name, send a GET request to /students/?name=:name
, where :name
is the name of the student to be searched.
To search for a student by name, send a GET request to /students?name=:name
, where :name
is the name of the student to be searched.
In case of any error, the API will return an appropriate HTTP status code along with a JSON response containing an error message.
This is a simple Student REST API that can be used to perform CRUD operations on student data. It can be extended further to include additional features as required.