added --spa to cli options

This commit is contained in:
Lloyd Brookes
2015-11-17 16:44:14 +00:00
parent e416a29d30
commit c6f6fcdcc1
4 changed files with 11 additions and 4 deletions

View File

@ -203,8 +203,6 @@ serving at http://localhost:8100
## API Reference ## API Reference
<a name="module_local-web-server"></a>
## local-web-server
<a name="exp_module_local-web-server--localWebServer"></a> <a name="exp_module_local-web-server--localWebServer"></a>
### localWebServer([options]) ⏏ ### localWebServer([options]) ⏏
Returns a Koa application Returns a Koa application

View File

@ -203,7 +203,12 @@ serving at http://localhost:8100
## API Reference ## API Reference
{{>main}} {{#module name="local-web-server"}}
{{>body~}}
{{>member-index~}}
{{>separator~}}
{{>members~}}
{{/module}}
* * * * * *

View File

@ -29,6 +29,10 @@ module.exports = {
description: 'A list of URL rewrite rules', group: 'server' description: 'A list of URL rewrite rules', group: 'server'
}, },
{ {
name: 'spa', alias: 's', type: String,
description: 'Single Page App page', group: 'server'
},
{
name: 'help', alias: 'h', type: Boolean, name: 'help', alias: 'h', type: Boolean,
description: 'Print these usage instructions', group: 'misc' description: 'Print these usage instructions', group: 'misc'
}, },

View File

@ -130,7 +130,7 @@ function localWebServer (options) {
if (options.spa) { if (options.spa) {
const send = require('koa-send') const send = require('koa-send')
app.use(_.all('*', function * () { app.use(_.all('*', function * () {
yield send(this, options.spa, { root: options.static.root || process.cwd() }) yield send(this, options.spa, { root: path.resolve(options.static.root) || process.cwd() })
})) }))
} }
return app return app