Static file server that works with HTML5 Pushstate.
JavaScript
Latest commit 8f830b3 Sep 27, 2016 @scottcorgan Release 2.1.0
Permalink
Failed to load latest commit information.
bin 💥 define args Sep 26, 2016
test Adds more tests Sep 13, 2016
.gitignore Add initial tests Sep 7, 2016
README.md Simplifies API and releases 2.0.0 Sep 13, 2016
index.js 💥 move to callback Sep 26, 2016
package.json Release 2.1.0 Sep 27, 2016

README.md

pushstate-server

Static file server that works with HTML5 Pushstate.

For example, the route /some/pushstate/route will return the index.html file. But, /some/static/path/logo.png will return the logo.png static file.

Install

npm install pushstate-server --save

Usage

var server = require('pushstate-server');

server.start({
  port: 3000,
  directory: './public'
});

or for multiple directories

var server = require('pushstate-server');

server.start({
  port: 4200,
  directories: ['./public', './bower_components']
});

Global Install

npm install -g pushstate-server
usage: pushstate-server [directory] [port]

API

start(options)

  • start the pushstate static file server
options
  • port
    • set the port that the server should open
    • uses process.env.PORT if not specified, and defaults to port 9000 if none is available
  • directory
    • the path to the directory where the static assets will be served
    • defaults to public
  • file
    • Custom file to serve
    • defaults to index.html