-
Notifications
You must be signed in to change notification settings - Fork 88
Home
Lloyd Brookes edited this page Feb 16, 2022
·
100 revisions
Feel free to edit this wiki. If something is missing or not clear, please raise a ticket.
Local-web-server is a distribution of lws bundled with a "starter pack" of useful middleware.
- Launch a simple HTTP development web server
- Launch a secure HTTPS development web server
- How to launch a secure HTTP2 development web server
- Open a web app in your mobile browser by scanning a QR code
- Configuration Management
- Using middleware
- Verbose output
- How to distribute with your project
- How to launch a browser together with the server
- How to use local-web-server programmatically (API Reference)
- CLI usage options
This table shows each middleware in the default stack, in order, with a link to a usage tutorial.
Name | Description |
---|---|
↓ Basic Auth | How to password-protect a server using Basic Authentication. |
↓ Body Parser | How to access the body of an incoming request |
↓ Request Monitor | Feeds traffic information to the --verbose output. |
↓ Log |
How to output an access log How to visualise access logs with third-party tools |
↓ Cors | How to configure Cross-Origin Resource Sharing (CORS) |
↓ Json | Pretty-prints JSON responses. |
↓ Rewrite | How to rewrite URLs to local or remote destinations |
↓ Blacklist | How to blacklist certain routes |
↓ Conditional Get | How to use HTTP Conditional Requests |
↓ Mime | How to customise mime types |
↓ Compress | Compress responses using gzip. |
↓ SPA | How to serve a Single Page Application (SPA) |
↓ Static | How to serve static files |
↓ Index | Serves directory listings. |
These are not part of the default middleware stack but can be added to a custom stack.
Name | Description |
---|---|
Redirect | Perform a 302 Redirect if the requested URL matches a specified regular expression. How to redirect HTTP traffic to HTTPS (satisfies Lighthouse audit) |
Error Detail | Includes the error stack trace in the response. |
- How to create a middleware module
- How to create a custom response for login requests
- How to prototype a REST API
- How to create a WebSocket server
- How to mock a Server-Sent Events (SSE) service
If you publish a middleware module, don't forget to add the lws-middleware
keyword.