node.js - How to run middleware on all routes except static assets -
is there way run middleware on express routes except static assets?
i tried running right in app.use('/', authenticate, app.router());
leads running static assets well.
would have list on routes?
as @explosion pills points out in comments,
add middleware after
express.static
middleware
sample codes below
app.use('/', express.static(path.resolve(root, './build/client'))); app.use(cors()); app.use(bodyparser.json()); app.use(bodyparser.urlencoded({extended: true}); // ... app.use('/', authenticate, app.router());
Comments
Post a Comment