spa-static
A web server to serve static files for SPAs.
Installation
$ npm i spa-static
Usage
Shell command
# Load from environment variables, only one server is supported$ HOST=localhost PORT=4002 spa-static# Load from config file, multiple servers are supported$ spa-static -c config.js
Node.js command
config {if e throw e;console;};
config
can be either an object or an array of objects with properties
below:
-
host
Default as
process.env.HOST
orlocalhost
-
port
Default as
process.env.PORT
or4000
-
prefix
Default as
process.env.PREFIX
or''
-
staticDir
Default as
process.env.STATIC
or./static
-
index
Default as
process.env.INDEX
or/index.html
Koa middleware
const Koa = ;const spaStatic = ;const app = ;app; // use default settings// orapp;