You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
591 B

9 years ago
  1. ## Single Page Application
  2. You're building a web app with client-side routing, so mark `index.html` as the SPA.
  3. ```sh
  4. $ ws --spa index.html
  5. ```
  6. By default, typical SPA paths (e.g. `/user/1`, `/login`) would return `404 Not Found` as a file does not exist with that path. By marking `index.html` as the SPA you create this rule:
  7. *If a static file at the requested path exists (e.g. `/css/style.css`) then serve it, if it does not (e.g. `/login`) then serve the specified SPA and handle the route client-side.*
  8. [Example](https://github.com/lwsjs/local-web-server/tree/master/example/spa).