Browse Source

rename localWebServer.create to listen

master
Lloyd Brookes 8 years ago
parent
commit
6757521946
  1. 6
      lib/local-web-server.js
  2. 6
      package.json
  3. 2
      test/test.js

6
lib/local-web-server.js

@ -6,7 +6,7 @@ const path = require('path')
* @example * @example
* const LocalWebServer = require('local-web-server') * const LocalWebServer = require('local-web-server')
* const localWebServer = new LocalWebServer() * const localWebServer = new LocalWebServer()
* const server = localWebServer.create({
* const server = localWebServer.listen({
* port: port, * port: port,
* directory: 'src' * directory: 'src'
* }) * })
@ -36,7 +36,7 @@ class LocalWebServer extends Lws {
* @param [options.moduleDir] {string[]} - One or more directories to search for feature modules. * @param [options.moduleDir] {string[]} - One or more directories to search for feature modules.
* @returns {Server} * @returns {Server}
*/ */
create (options) {
listen (options) {
const usage = require('lws/lib/usage') const usage = require('lws/lib/usage')
usage.defaults usage.defaults
.set('an', 'ws') .set('an', 'ws')
@ -47,7 +47,7 @@ class LocalWebServer extends Lws {
modulePrefix: 'lws-', modulePrefix: 'lws-',
stack: require('./default-stack') stack: require('./default-stack')
}, options) }, options)
return super.create(options)
return super.listen(options)
} }
} }

6
package.json

@ -32,9 +32,9 @@
"repository": "https://github.com/lwsjs/local-web-server", "repository": "https://github.com/lwsjs/local-web-server",
"author": "Lloyd Brookes <75pound@gmail.com>", "author": "Lloyd Brookes <75pound@gmail.com>",
"dependencies": { "dependencies": {
"lws": "^1.0.0-pre3.1",
"lws": "^1.0.0-pre4.0",
"lws-blacklist": "^0.2.1", "lws-blacklist": "^0.2.1",
"lws-body-parser": "^0.2.2",
"lws-body-parser": "^0.2.4",
"lws-compress": "^0.2.1", "lws-compress": "^0.2.1",
"lws-conditional-get": "^0.3.3", "lws-conditional-get": "^0.3.3",
"lws-cors": "^0.3.2", "lws-cors": "^0.3.2",
@ -46,7 +46,7 @@
"lws-request-monitor": "^0.1.3", "lws-request-monitor": "^0.1.3",
"lws-rewrite": "^0.3.5", "lws-rewrite": "^0.3.5",
"lws-spa": "^0.2.2", "lws-spa": "^0.2.2",
"lws-static": "^0.4.0"
"lws-static": "^0.4.1"
}, },
"devDependencies": { "devDependencies": {
"coveralls": "^2.13.1", "coveralls": "^2.13.1",

2
test/test.js

@ -11,7 +11,7 @@ const runner = new TestRunner()
runner.test('basic', async function () { runner.test('basic', async function () {
const port = 9000 + this.index const port = 9000 + this.index
const localWebServer = new LocalWebServer() const localWebServer = new LocalWebServer()
const server = localWebServer.create({
const server = localWebServer.listen({
port: port, port: port,
directory: 'test/fixture' directory: 'test/fixture'
}) })

Loading…
Cancel
Save