Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lws-spa

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lws-spa - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

test/one.txt

4

index.js

@@ -1,3 +0,1 @@

'use strict'
module.exports = MiddlewareBase => class SPA extends MiddlewareBase {

@@ -31,3 +29,3 @@ description () {

const assetTest = new RegExp(options['spa.asset-test'] || '\\.')
this.view.write('spa.config', { root, assetTest })
this.emit('verbose', 'middleware.spa.config', { root, assetTest })
return _.get('*', (ctx, route, next) => {

@@ -34,0 +32,0 @@ if (ctx.accepts('text/html') && !assetTest.test(route)) {

{
"name": "lws-spa",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "0.2.0",
"description": "spa",
"version": "0.2.1",
"description": "Middleware adding support for Single Page Applications to lws",
"repository": "https://github.com/lwsjs/spa.git",

@@ -11,11 +11,9 @@ "license": "MIT",

"lws",
"lws-feature",
"spa"
],
"engines": {
"node": ">=4"
"node": ">=7.6"
},
"scripts": {
"test": "test-runner test/*.js",
"docs": "jsdoc2md -t jsdoc2md/README.md lib/*.js > README.md; echo"
"test": "test-runner test/*.js"
},

@@ -25,3 +23,9 @@ "dependencies": {

"koa-send": "^4.1.0"
},
"devDependencies": {
"lws": "^1.0.0-pre2.2",
"lws-static": "^0.3.1",
"req-then": "^0.6.2",
"test-runner": "^0.4.0"
}
}

@@ -9,19 +9,6 @@ [![view on npm](https://img.shields.io/npm/v/lws-spa.svg)](https://www.npmjs.org/package/lws-spa)

Adds the "Single Page Application" feature to lws.
Middleware adding support for Single Page Applications to lws. For usage instructions, see [here](https://github.com/lwsjs/local-web-server/wiki/How-to-serve-a-Single-Page-Application-(SPA)).
## Synopsis
You're building a web app with client-side routing, so mark `index.html` as the SPA.
```sh
$ lws --stack spa --spa index.html
```
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:
*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.*
[Example](https://github.com/75lb/local-web-server/tree/master/example/spa).
* * *
&copy; 2016-17 Lloyd Brookes <75pound@gmail.com>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
&copy; 2016-17 Lloyd Brookes <75pound@gmail.com>.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc