Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get parameter for delete request in express node js

I am fresher to nodejs. How to get the value parameter pass via Delete request? I am using node express js. Thanks in advs

like image 515
jason Avatar asked Nov 18 '14 04:11

jason


People also ask

How do you pass parameters in GET request node js?

The GET request is sent by calling the request method of the http module. Various options for the GET request can be set through a parameter. const http = require('http'); const querystring = require('querystring'); // GET parameters const parameters = { id: 123, type: "post" } // GET parameters as query string : "?

How do you access GET parameters after Express?

We can access these route parameters on our req. params object using the syntax shown below. app. get(/:id, (req, res) => { const id = req.params.id; });

What is request params in Express?

The req. params property is an object that contains the properties which are mapped to the named route "parameters". For example, if you have a route as /api/:name, then the "name" property is available as req.params.name. The default value of this object is {}.


1 Answers

You may use "req.body" to get the value of you send

eg:

router.delete('/test',function(req,res){
     res.send(req.body.data);
});
like image 169
Saravanan Rajaraman Avatar answered Sep 18 '22 20:09

Saravanan Rajaraman