-
Notifications
You must be signed in to change notification settings - Fork 87
API reference
Lloyd Brookes edited this page Jul 8, 2017
·
17 revisions
Example
const LocalWebServer = require('local-web-server')
const localWebServer = new LocalWebServer()
const server = localWebServer.create({
port: port,
directory: 'src'
})
-
local-web-server
-
LocalWebServer ⏏
-
.create([options]) ⇒
Server
-
.create([options]) ⇒
-
LocalWebServer ⏏
Create a listening HTTP/HTTPS server.
Kind: instance method of LocalWebServer
Param | Type | Description |
---|---|---|
[options] | object |
Server options |
[options.port] | number |
Port |
[options.hostname] | string |
The hostname (or IP address) to listen on. Defaults to 0.0.0.0. |
[options.maxConnections] | number |
The maximum number of concurrent connections supported by the server. |
[options.keepAliveTimeout] | number |
The period (in milliseconds) of inactivity a connection will remain open before being destroyed. Set to 0 to keep connections open indefinitely. |
[options.configFile] | string |
Config file path, defaults to 'lws.config.js'. |
[options.https] | boolean |
Enable HTTPS using a built-in key and cert registered to the domain 127.0.0.1. |
[options.key] | string |
SSL key file path. Supply along with --cert to launch a https server. |
[options.cert] | string |
SSL cert file path. Supply along with --key to launch a https server. |
[options.pfx] | string |
Path to an PFX or PKCS12 encoded private key and certificate chain. An alternative to providing --key and --cert. |
[options.ciphers] | string |
Optional cipher suite specification, replacing the default. |
[options.secureProtocol] | string |
Optional SSL method to use, default is "SSLv23_method". |
[options.stack] |
Array.<string> | Array.<Middlewares>
|
Array of feature classes, or filenames of modules exporting a feature class. |
[options.server] |
string | ServerFactory
|
Custom server factory, e.g. lws-http2. |
[options.websocket] |
string | Websocket
|
Path to a websocket module |
[options.moduleDir] | Array.<string> |
One or more directories to search for feature modules. |