Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scottcorgan/pushstate-server
Static file server that works with HTML5 Pushstate.
https://github.com/scottcorgan/pushstate-server
html5-pushstate node pushstate-server server
Last synced: 4 days ago
JSON representation
Static file server that works with HTML5 Pushstate.
- Host: GitHub
- URL: https://github.com/scottcorgan/pushstate-server
- Owner: scottcorgan
- Created: 2013-08-27T20:47:44.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-11-19T09:39:39.000Z (about 4 years ago)
- Last Synced: 2024-12-20T20:38:03.516Z (5 days ago)
- Topics: html5-pushstate, node, pushstate-server, server
- Language: JavaScript
- Size: 221 KB
- Stars: 421
- Watchers: 3
- Forks: 35
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```js
var server = require('pushstate-server');server.start({
port: 3000,
directory: './public'
});
```or for multiple directories
```js
var server = require('pushstate-server');server.start({
port: 4200,
directories: ['./public', './bower_components']
});
```or bind to a particular host
```js
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`