mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
[Tests] addServerMiddleware with string path
This commit is contained in:
parent
08fd004044
commit
04d3a22212
@ -8,6 +8,8 @@ module.exports = function middlewareModule (options) {
|
|||||||
res.end('It works!')
|
res.end('It works!')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// Add local middleware js
|
||||||
|
this.addServerMiddleware('~/modules/middleware/log.js')
|
||||||
// Add plain middleware
|
// Add plain middleware
|
||||||
this.addServerMiddleware((req, res, next) => {
|
this.addServerMiddleware((req, res, next) => {
|
||||||
next()
|
next()
|
||||||
|
5
test/fixtures/module/modules/middleware/log.js
vendored
Executable file
5
test/fixtures/module/modules/middleware/log.js
vendored
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = function (req, res, next) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(req.url)
|
||||||
|
next()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user