morgan 1.9.0
使用和构建一个快速应用程序browser-refresh 1.7.2
。
摩根似乎忽略了这个skip
选项。我的应用程序初始化为
const skipFcn = (req, res) => req.path.startsWith('/static/views')
app.use((req, res, next) => {
console.log('test:', skipFcn(req, res))
next()
})
app.use(morgan('combined', {
skip: skipFcn
}))
但在我的日志中,我仍然收到数百次点击browser-refresh
:
test: true
::1 - - [14/Oct/2017:10:09:07 +0000] "GET /static/views/project$0.0.0/views/components/service-form.marko.jsHTTP/1.1" 200 3748 "http://localhost:4002/admin/services" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"