Need help with pushstate-server?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

scottcorgan
419 Stars 42 Forks 105 Commits 12 Opened issues

Description

Static file server that works with HTML5 Pushstate.

Services available

!
?

Need anything else?

Contributors list

# 142,845
HTML
TypeScr...
browser...
xmlhttp...
40 commits
# 5,532
JavaScr...
TypeScr...
create-...
React
4 commits
# 79,492
css-fra...
flexbox
sidebar
CSS
3 commits
# 139,273
high-si...
CSS
React
HTML
3 commits
# 181,339
fish-sh...
node
autocom...
lsp
2 commits
# 567,419
JavaScr...
node
2 commits
# 10
JavaScr...
React
Redux
TypeScr...
2 commits
# 13,749
Vue.js
ecmascr...
statech...
vuex
1 commit
# 82,048
C
MATLAB
matrice...
complex...
1 commit
# 265,096
HTML
rwd
CSS
datatab...
1 commit
# 248,393
HTML
node
C#
Git
1 commit
# 528,252
Shell
gem
Rails
devise
1 commit
# 627,571
JavaScr...
node
1 commit
# 4,009
JavaScr...
React
Firebas...
react-a...
1 commit
# 256,776
touchid
faceid
TypeScr...
travis-...
1 commit
# 625,119
JavaScr...
node
1 commit
# 58,060
React
TypeScr...
lenses
mobx
1 commit

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'] });

or bind to a particular host

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

Global Install

npm install -g pushstate-server
usage: pushstate-server [-d directory] [-p port] [-f file]

API

start(options[, callback])

  • 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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.