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

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -