lws-rewrite is a middleware plugin for lws (Local Web Server) that adds URL rewriting support. Current stable version is 4.0.0, released under the ISC license. It allows defining rewrite rules via command-line options to map source URLs to local or remote destinations, supporting pattern-based replacements. Key differentiator: integrates seamlessly with lws's plugin architecture and its wiki provides detailed usage examples. The project is maintained with regular updates, compatible with Node.js >=12.17.
npm install lws-rewriteVerified import paths — ran on the pinned version, not inferred.
Demonstrates programmatic usage of lws-rewrite plugin with lws, setting up rewrite rules to proxy API requests and redirect a path.
Use format '/from -> /to' with spaces around '->'.
Upgrade to Node.js >=12.17 and use ESM imports.
Use '--rewrite' instead of deprecated options.
Order rules from most specific to least specific.
Use lws proxy middleware for full proxy support.
Run 'npm install lws-rewrite' in your project.
Use ESM import: import Rewrite from 'lws-rewrite'
Use correct format: '/old -> /new'