app.use – allow to pass an array of middleware without specifying a path.

I think it would make our development process faster, our code cleaner if we can do this:

app.use([
  bodyParser.json(),
  bodyParser.urlencoded({ extended: true }),
  expressValidator(),
  passport.initialize(),
  passport.session()
]);

Instead of

  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(expressValidator());
  app.use(passport.initialize());
  app.use(passport.session());

What do you think?

Author: Fantashit

1 thought on “app.use – allow to pass an array of middleware without specifying a path.

Comments are closed.