-
Notifications
You must be signed in to change notification settings - Fork 88
API reference
Lloyd Brookes edited this page Jul 6, 2021
·
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:
import LocalWebServer from 'local-web-server'
const ws = await LocalWebServer.create({
port: 9000,
directory: 'public'
})
/* make requests */
// curl http://localhost:9000
/* shut down */
ws.server.close()