diff --git a/server.js b/server.js index 530ac4dc..d18b4a98 100644 --- a/server.js +++ b/server.js @@ -10,19 +10,23 @@ app.use(express.json()); const baseRouter = express.Router(); baseRouter.get('/greeting', (req, res) => { - return res.send(''); + return res.send('Hello world!'); }); -baseRouter.post('/add', (req, res) => { - res.json({ "": null }); +baseRouter.post('/add', (req, res) => {3 + const a1=parseInt(req.body.first); + const a2=parseInt(req.body.second); + res.json({ "result": a1+a2 }); }); baseRouter.post('/subtract', (req, res) => { - res.json({ "": null }); + const a=parseInt(req.body.first); + const b=parseInt(req.body.second); + res.json({ "result": a-b }); }); app.use(baseUrl, baseRouter); app.listen(PORT, () => { - console.log("Server running at PORT", PORT); + console.log("Server running at PORT", PORT); }); \ No newline at end of file