You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2.8 KiB

local-web-server

Emits: module:local-web-server#event:verbose
Example

const LocalWebServer = require('local-web-server')
const localWebServer = new LocalWebServer()
const server = localWebServer.listen({
  port: 8050,
  https: true,
  directory: 'src',
  spa: 'index.html',
  websocket: 'src/websocket-server.js'
})
// secure, SPA server with listening websocket now ready on port 8050

LocalWebServer ⏏

Kind: Exported class

localWebServer.listen([options]) ⇒ Server

Returns a listening HTTP/HTTPS server.

Kind: instance method of LocalWebServer
Params

  • [options] object - Server options
    • [.port] number - Port
    • [.hostname] string - The hostname (or IP address) to listen on. Defaults to 0.0.0.0.
    • [.maxConnections] number - The maximum number of concurrent connections supported by the server.
    • [.keepAliveTimeout] number - The period (in milliseconds) of inactivity a connection will remain open before being destroyed. Set to 0 to keep connections open indefinitely.
    • [.configFile] string - Config file path, defaults to 'lws.config.js'.
    • [.https] boolean - Enable HTTPS using a built-in key and cert registered to the domain 127.0.0.1.
    • [.key] string - SSL key file path. Supply along with --cert to launch a https server.
    • [.cert] string - SSL cert file path. Supply along with --key to launch a https server.
    • [.pfx] string - Path to an PFX or PKCS12 encoded private key and certificate chain. An alternative to providing --key and --cert.
    • [.ciphers] string - Optional cipher suite specification, replacing the default.
    • [.secureProtocol] string - Optional SSL method to use, default is "SSLv23_method".
    • [.stack] Array.<string> | Array.<Middlewares> - Array of feature classes, or filenames of modules exporting a feature class.
    • [.server] string | ServerFactory - Custom server factory, e.g. lws-http2.
    • [.websocket] string | Websocket - Path to a websocket module
    • [.moduleDir] Array.<string> - One or more directories to search for modules.