How to fetch GET, POST and URL based params with NodeJS
I always forget that, here a brief reminder.
To fetch GET params
app.get("/page",function(req,res) {
var param = req.query["param"];
});
To fetch POST params
app.use(express.bodyParser());
app.get("/page",function(req,res) {
var param = req.body["param"];
});
To fetch URL Route params :
app.get("/page_:param/",function(req,res) {
var param = req.params.param
});
Written by pmaoui
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Express
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#