mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 14:45:15 +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()
|
|
})
|
|
}
|