mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-01 01:47:11 +00:00
19 lines
388 B
JavaScript
Executable File
19 lines
388 B
JavaScript
Executable File
|
|
module.exports = function middlewareModule (options) {
|
|
return new Promise((resolve, reject) => {
|
|
// Add /api endpoint
|
|
this.addServerMiddleware({
|
|
path: '/api',
|
|
handler (req, res, next) {
|
|
res.end('It works!')
|
|
}
|
|
})
|
|
// Add plain middleware
|
|
this.addServerMiddleware((req, res, next) => {
|
|
next()
|
|
})
|
|
// Resolve
|
|
resolve()
|
|
})
|
|
}
|