title: Express app.use() with 2 middleware cannot work together
body: <p>I am trying to apply "Basic Auth" OR "Bearer Token" to all routes started with "/auth"</p>
  
  <p>In the same router file "routes/auth.js", I prepared the 2 router types and exported them together. Then in "app.js", I am trying to apply both middleware to "app.use()".</p>
  
  <p>The result is, not both types are working at the same time. Only the 1st position middleware is affecting all "/auth" routes, that is:- </p>
  
  <pre><code>app.use('/auth', [affecting-all-auth-routes, no-effect-on-all-auth-routes]);
  </code></pre>
  
  <p>These are the reference sites that I tried:-
  <a href="http://expressjs.com/zh-tw/api.html#app.use" rel="nofollow noreferrer">http://expressjs.com/zh-tw/api.html#app.use</a></p>
  
  <pre><code>app.use('/', [r1, r2]);
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/25602948/what-is-a-better-way-to-authenticate-some-of-the-routes-on-express-4-router">What is a better way to authenticate some of the routes on Express 4 Router?</a></p>
  
  <p>I guess it may due to some syntax error. Could you please give me some idea?</p>
  
  <p>// app.js</p>
  
  <pre><code>const express = require('express');
  
  const authRouter = require('./routes/auth');
  
  const app = express();
  
  app.use('/auth', [authRouter.basic, authRouter.bearer]);
  </code></pre>
  
  <p>// routes/auth.js</p>
  
  <pre><code>const express = require('express');
  var routerBasic = express.Router();
  var routerBearer = express.Router();
  
  const basicAuth = require('express-basic-auth');
  const jwtProtected = require('./middleware/jwToken');
  
  routerBasic.use(basicAuth({
      users: { 'admin': '1234' }
  }))
  routerBearer.use(jwtProtected);
  
  const login = require('../controllers/Auth/Basic/login');
  const tokenRevoke = require('../controllers/Auth/Token/revoke-token');
  
  routerBasic.post('/login', login);
  routerBearer.post('/token/revoke', tokenRevoke);
  
  module.exports = {
      basic: routerBasic,
      bearer: routerBearer
  }
  </code></pre>