upgrade koa-route

This commit is contained in:
Lloyd Brookes
2015-11-22 19:38:08 +00:00
parent 63f329b297
commit f0d36ac89f
4 changed files with 18 additions and 5 deletions

View File

@ -162,8 +162,9 @@ function localWebServer (options) {
if (options.spa) {
const send = require('koa-send')
debug('SPA', options.spa)
app.use(_.all('*', function * () {
yield send(this, options.spa, { root: path.resolve(options.static.root) || process.cwd() })
app.use(_.all('*', function spa (ctx, route, next) {
const root = path.resolve(options.static.root) || process.cwd()
return send(ctx, options.spa, { root: root }).then(next)
}))
}
return app