title: NodeJS - req.params is undefined
body: <p>I need to get data by id from server.<br>
  I wrote a service by Angular 2:  </p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Http, Response, Headers } from '@angular/http';
  
  import { AppConfig } from '../appConfig';
  import { JwtService } from './jwt.service';
  
  @Injectable()
  export class MemberService {
  
    constructor(
        private http: Http,
        private appConfig: AppConfig,
        private jwtService: JwtService) { }
  
    getMembersById(id: number) {
      const headers = new Headers();
      headers.append('Authorization', 'Token ' + this.jwtService.getToken());
  
      return this.http.get(this.appConfig.urlServer + '/members/' + id, { headers: headers })
          .map((res: Response) =&gt; res.json())
    }
  }
  </code></pre>
  
  <p>A code my server:  </p>
  
  <pre><code>const express = require('express');
  const cors = require('cors');
  const bodyParser = require('body-parser');
  const morgan = require('morgan');
  const flash = require('connect-flash');
  const expressSession = require('express-session');
  const nconf = require('./config');
  const tables = require('./create_tables');
  const routes = require('./routes');
  const passport = require('passport');
  const app = express();
  
  const port = nconf.get('port');
  app.set('port', (process.env.PORT || port));
  
  tables.create_tables();
  
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({
      extend: false
  }));
  
  app.use(morgan('dev'));
  app.use(cors());
  
  app.use(passport.initialize());
  app.use(passport.session());
  app.use(expressSession({
      secret: 'keyboard cat'
  }));
  app.use(flash());
  
  require('./passport/passport')(passport);
  
  app.use('/', routes);
  
  app.listen(app.get('port'));
  
  module.export = app;
  </code></pre>
  
  <p>Also I created <code>index.js</code> which set the routes for the app:  </p>
  
  <pre><code>const express = require('express');
  const router = express();
  const members = require('./members');
  
  router.use('/members', members);
  
  module.exports = router;
  </code></pre>
  
  <p>And I made the method in the <code>members.js</code>:  </p>
  
  <pre><code>const express = require('express');
  const mysql = require('mysql');
  const nconf = require('../config');
  const connection = mysql.createConnection(nconf.get('db'));
  const token = require('../middlewares/token');
  const router = express();
  
  router.get('/:id', token.required, getGroupsById);
  
  module.exports = router;
  
  function getGroupsById(res, req) {
    console.log(req.params);
  }
  </code></pre>
  
  <p>Id is a number. Then I send it to my server but when I want to see got parameters I have the error:<br>
  <code>undefined</code></p>
  
  <p>I cannot understand where I made the errors. I seached in the stackoverflow answers and it don't help to me for resolving my problem.<br>
  Perhaps, somewhere I made the errors and now I cannot find it.<br>
  Please, help to me anybody. </p>