{"library":"lws-rewrite","title":"lws-rewrite","description":"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.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install lws-rewrite"],"cli":null},"imports":["import lws from 'lws'","import Rewrite from 'lws-rewrite'","npx lws --rewrite '/old -> /new'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import lws from 'lws'\nimport Rewrite from 'lws-rewrite'\n\nconst server = lws.create({\n  port: 8080,\n  stack: [new Rewrite()],\n  rewrite: [\n    '/api/* -> http://localhost:3000/api/$1',\n    '/old-path -> /new-path'\n  ]\n})\n\nserver.start().then(() => {\n  console.log('Server started on http://localhost:8080')\n})","lang":"typescript","description":"Demonstrates programmatic usage of lws-rewrite plugin with lws, setting up rewrite rules to proxy API requests and redirect a path.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}