10 sdc
PROGRAM 10. Develop an express web application that can interact with REST API to perform1 4 CRUD operations on student data. (Use Postman). Server.js const express = require('express'); const app = express(); app.use(express.json()); let students = []; // CREATE app.post('/students', (req, res) => { const student = { id: students.length + 1, name: req.body.name, course: req.body.course }; students.push(student); res.send("Student Added Successfully"); }); // READ app.get('/students', (req, res) => { res.json(students); }); // UPDATE app.put('/students/:id', (req, res) => { const id = parseInt(req.params.id); const student = students.find(s => s.id === id); if(student){ student.name = req.body.name; student.course = req....