From 8fdf05a072e71adde57357f2cc71df113a0412db Mon Sep 17 00:00:00 2001 From: Ambhi2609 <86223211+Ambhi2609@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:17:47 +0530 Subject: [PATCH] Update index.js Configuring the post request router in lcowebserver to handle post request without /post route in url --- lcowebserver/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lcowebserver/index.js b/lcowebserver/index.js index cc4f2ac..0bf119c 100644 --- a/lcowebserver/index.js +++ b/lcowebserver/index.js @@ -18,6 +18,11 @@ app.get('/get', (req, res) => { res.status(200).json({message: "Hello from learnCodeonline.in"}) }) +app.post('/', (req, res) => { + let myJson = req.body; // your JSON + + res.status(200).send(myJson); +}) app.post('/post', (req, res) => { let myJson = req.body; // your JSON @@ -32,4 +37,4 @@ app.post('/postform', (req, res) => { app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`) -}) \ No newline at end of file +})