0

I'm wondering if this can be done with Node.js and express.js. On my incoming url i have parameters such as.

http://localhost:8080/restaurant.html?siteid=7&locationid=8&companyid=7

I want to extract the query and then append it to any incoming request

so that when the client code calls for my JSON and my router sends the request to

 app.get('/siteinfo.json', function(req, res) {
  console.log(company, site , location);
  getdata_hdlr.get_site_setup(company, site , location);
 });

I can pass the query params on to the function being called.

Can this be done or do I need to do this in my client code?

ddpishere
  • 751
  • 1
  • 8
  • 23

1 Answers1

1

You will need to use req.query and then save all the data in req.session, then use session to extract the data that you need.

micnic
  • 10,915
  • 5
  • 44
  • 55
  • I believe this needs the `express.urlencoded()` middleware in place to parse the query string. – max Jan 17 '14 at 13:03