{"library":"lws-spa","title":"lws-spa","description":"lws-spa is a middleware plugin for lws (local-web-server) that adds Single Page Application support. As of version 4.1.1 (stable, active maintenance), it allows you to serve a SPA by providing a fallback file (e.g., app.html) that is returned for non-asset requests, with configurable asset detection using regular expressions or filesystem checks. It integrates seamlessly into lws's plugin architecture and is updated occasionally; the package is part of the lws ecosystem and targets Node.js >=12.17. Compared to generic static file servers, lws-spa provides SPA-specific options like asset testing via regex or filesystem, making it a focused solution for SPA development.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install lws-spa"],"cli":{"name":"lws","version":null}},"imports":["import lwsSpa from 'lws-spa'","import lwsSpa from 'lws-spa'","import lwsSpa from 'lws-spa'; export { lwsSpa as default }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import lws from 'lws'\nimport lwsSpa from 'lws-spa'\n\nconst server = lws({\n  stack: [lwsSpa],\n  port: 8080,\n  directory: './public',\n  spa: 'app.html'\n})\n\nserver.listen(() => {\n  console.log('SPA server running on http://localhost:8080')\n})","lang":"typescript","description":"Creates an lws server with SPA support using lws-spa middleware and serves app.html as fallback for all non-asset requests.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}