Skip to content

Commit

Permalink
feat(core): skip invalid middlewares instead of self-destory
Browse files Browse the repository at this point in the history
  • Loading branch information
a632079 committed May 29, 2020
1 parent fa17bc9 commit cc2e24d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,16 @@ async function registerMiddlewares () {
try {
const middlewares = require('./plugins')
await middlewares.map((middleware, index, input) => {
app.use(middleware)
if (middleware) { // skip invalid middleware
app.use(middleware)
}
})
if (program.dev) {
const devMiddlewares = require('./plugins.dev')
await devMiddlewares.map((middleware, index, input) => {
app.use(middleware)
if (middleware) { // skip invalid middleware
app.use(middleware)
}
})
}
winston.verbose('Plugins are loaded.')
Expand Down

0 comments on commit cc2e24d

Please sign in to comment.