Lightweight node server for serving assets specifically for Single Page Applications
Last updated a year ago by tsollbach .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @grapes-agency/simple-spa-server 
SYNC missed versions from official npm registry.

Simple SPA Server:

simple-spa-server is our standard static file server to serve SPA assets (index.html, js/css bundles etc.).

It does not do much more than just serve the files and use mime-types to set a Content-Type header. For production deployment we would expect a fully configured reverse proxy in front.

What it can do in addition to that is inject env variables into your index.html by placing a <script> tag in the HTML head which will set a process.env object on the window. These variables can be picked from a provided .env file (using dotenv) or from the server side process.env or both.


Installation via npm:

npm install @grapes-agency/simple-spa-server

This will install into your local node_modules and make the command simple-spa-server available in node_modules/bin (can be used in npm scripts that way).

To make it available globally:

npm install -g @grapes-agency/simple-spa-server


simple-spa-server <path> [options]

<path> is required and should point to the folder where the index.html for your SPA is located.

Application should be available under http://localhost:8080

Available Options:

-p or --port Port to use (defaults to 8080)

-k or --keys Comma separated list of keys to pick vom process.env and inject into index.html. If .env file is present this option will pick from these as well. If omitted and .env is present, all keys from .env will be injected.

Current Tags

  • 1.1.5                                ...           latest (a year ago)

8 Versions

  • 1.1.5                                ...           a year ago
  • 1.1.4                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (10)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |