
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
express-spa
Advanced tools
Static sites are great until you want html5 push state urls. Then they suck because every path besides the index breaks on external entry.

Static sites are great until you want html5 push state urls. Then they suck because every path besides the index breaks on external entry.
In case that didn't make any sense imagine the following sequence.
GET /)./some/page.GET /some/page).With express-spa this is fixed.
var express = require('express')
var spa = require('express-spa')
var app = express()
app.use(spa())
All requests for html regardless of path will stream the index html file. The filepath defaults to index.html in the root of the project folder. Absolute paths and paths relative to the project folder are supported.
// project/server/app.js
spa() // project/index.html
spa('views/index.html') // project/views/index.html
spa(__dirname + '/main.html') // project/server/main.html
Rest assured project folder does not mean process.cwd(). It means project folder.
You can also pass in an object of replacements. This way you don't need a view rendering engine to inject a couple variables. Rendering with jade can take up to 200ms instead of like 6ms.
<body>
<script>window.VERSION = '$VERSION';</script>
</body>
Be careful to avoid unwanted matches.
spa({ '$VERSION': '1.1' })
The streamed markup will have the replacement.
<body>
<script>window.VERSION = "1.1"</script>
</body>
You can specify both file path and replacements.
spa('filename.html', { key: 'value' })
Install with npm.
$ npm install express-spa --save
For max performance check out Divshot to serve static sites off a CDN.
License: MIT
FAQs
Static sites are great until you want html5 push state urls. Then they suck because every path besides the index breaks on external entry.
The npm package express-spa receives a total of 15 weekly downloads. As such, express-spa popularity was classified as not popular.
We found that express-spa demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.