v3.0.0
Breaking changes since v2.6.1
- Removed support for Node versions less than v8.
- Removed
--websocket
option.- You can implement websocket support using a middleware plugin, see here for an example.
- Removed
--server
option.- Its primary use case was to supply a third-party HTTP2 server. This is no longer required since HTTP2 is now included with node.
- Removed mock-responses from the default stack, however you can still use the plugin in a custom stack.
- Since it's easy enough to create mock responses using vanilla middleware functions, the plugin didn't get much use.
- New programmatic API.
- New Middleware plugin API.
- New View plugin API.
ws middleware-list
command is nowws --default-stack
.--rewrite
has been upgraded to use the latest version of path-to-regexp, which has changed the syntax for the wildcard asterix.
New features
--static.extensions
. #120, docs--spa.asset-test-fs
lwsjs/spa#1, docs--rewrite
now works behind an HTTP proxy. #114configFile
is now honoured when using programmatic API. #115- Lots of new API and wiki documentation written with more to come.
Other fixes
- Middleware stack plugin loading now works correctly with Node v12.
- Upgraded and optimised dependency tree.
Upgrade notes
Some tips on upgrading from v2 to v3.
- If you use
--rewrite
and have an asterix wildcard in yourfrom
expression (e.g./api/*
) you'll need to change the asterix to(.*)
, e.g./api/(.*)
. - To upgrade your middleware plugin, check the new API docs. The only difference is that the exported plugin is now a plain class, not a decorator function as before.
- The main difference with the new programmatic API is that you now launch a server with
LocalWebServer.create
rather thanlocalWebServer.listen
as before. - If you use lws-mock-responses, you'll need to install the plugin into your project then include it in a custom stack - example below.
npm i --save-dev lws-mock-responses ws --stack mock-responses static index
If you have any questions, post an issue - thanks.