WebApp.connectHandlers work for unique parameters?


Will Meteor’s WebApp.connectHandlers.use('/:param', (req, res, next)... work?

I mean if I have a unique token or an id in the url, do I have to use a module like connect-route or will that work? I am asking since it is not mentioned in the official meteor docs: https://docs.meteor.com/packages/webapp.html


according to the docs you could do

WebApp.connectHandlers.use('/token', (req, res, next) => {
  var token = req.url.split('/')[1];
  token = token || 'no token';
  res.end(`Hello world from: ${Meteor.release} ${token}`);


I’ve also found using queryParams to be pretty straightforward:

import url from 'url';

WebApp.connectHandlers.use('/someRoute', function (req, res) {

  const queryString = url.parse(req.url).query;
  const params = {};
  queryString.split('&').forEach((pair) => {
    params[pair.split('=')[0]] = pair.split('=')[1];

  console.log(params); // A key/value object of your incoming queryParams