- Notifications
You must be signed in to change notification settings - Fork90
API reference
Lloyd Brookes edited this pageJul 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-serverhas a default middleware stack while lws does not.
- local-web-serveradds itself to the plugin module search path, meaning when you type
--stack lws-staticit will first search the current working directory then the local-web-server installation for thelws-staticmodule.
Trival example:
importLocalWebServerfrom'local-web-server'constws=awaitLocalWebServer.create({port:9000,directory:'public'})/* make requests */// curl http://localhost:9000/* shut down */ws.server.close()