export default function(): PluginOption {
return {
name: 'name',
apply: 'serve',
configureServer (server) {
const myMiddleware = (req, res, next) => {
console.log('Middleware added ')
next()
}
server.middlewares.use(myMiddleware)
const middlewareStack = server.middlewares.stack
const myMiddlewareCopy = middlewareStack.pop()
middlewareStack.push(myMiddlewareCopy)
}
}
}