title: Query parameters in Express
body: <p>I am trying to get access to query parameters using Express in Node.js.  For some reason, <code>req.params</code> keeps coming up as an empty object.  Here is my code in <code>server.js</code>:</p>
  
  <pre><code>const express    = require('express');
  const exphbs     = require('express-handlebars');
  const bodyParser = require('body-parser');
  const https      = require('https');
  
  //custom packages  ..
  //const config  = require('./config');
  const routes  = require('./routes/routes');
  
  
  const port = process.env.port || 3000;
  
  
  var app = express();
  
  //templating engine Handlebars
  app.engine('handlebars', exphbs({defaultLayout: 'main'}));
  app.set('view engine', 'handlebars');
  
  
  
  
  
  //connect public route
  app.use(express.static(__dirname + '/public/'));
  
  
  app.use(bodyParser.json());
  
  //connect routes
  app.use('/', routes);
  
  
  
  
  
  
  app.listen(port,  () =&gt; {
      console.log( 'Server is up and running on ' + port );
  });
  </code></pre>
  
  <p>And here is my routes file:</p>
  
  <pre><code>//updated
  const routes = require('express').Router();
  
  
  routes.get('/', (req, res) =&gt; {
    res.render('home');
  });
  
  
  
  routes.post('/scan',  (req, res) =&gt; {
      res.status(200);
  
      res.send("hello");
  });
  
  
  
  routes.get('/scanned',  (req, res) =&gt; {
  
      const orderID = req.params;
      console.log( req );
  
      res.render('home', {
          orderID
      });
  });
  
  module.exports = routes;
  </code></pre>
  
  <p>When the server is up and running, I am navigating to <code>http://localhost:3000/scanned?orderid=234</code>.  The console log that I currently have in the <code>routes.js</code> file is showing an empty body (not recognizing <code>orderid</code> parameter in the URL).</p>