-
Notifications
You must be signed in to change notification settings - Fork 87
API reference
Lloyd Brookes edited this page Jun 19, 2019
·
17 revisions
Please see the lws API docs. The local-web-server programmatic API is identical to lws with two differences:
- local-web-server has a default middleware stack while lws does not.
- local-web-server adds itself to the plugin module search path, meaning when you type
--stack lws-static
it will first search the current working directory then the local-web-server installation for thelws-static
module.
Trival example:
const LocalWebServer = require('local-web-server')
const ws = LocalWebServer.create({
port: 9000,
directory: 'public'
})
/* make requests */
// curl http://localhost:9000
/* shut down */
ws.server.close()