Middleware when use ES6 with babel - Need opinion

41 views
Skip to first unread message

Mahendran Nayar

unread,
Sep 7, 2016, 9:34:29 AM9/7/16
to Express
Need your opinion. Me working on first Node/Express project.

I've a routes file with one module.exports called users.js

It contains only routes like 

app.route("/user")
        .get((req, res) => {


This imported into a main middleware file with ES6

import users from "../app/users";

and then invoked like users(app); This works fine.

Is this OK or is there any down side compare to require('../app/users')(app); or app.use()??






Reply all
Reply to author
Forward
0 new messages