Giter VIP home page Giter VIP logo

pushstate-server's Introduction

pushstate-server

Static file server that works with HTML5 Pushstate.

Defaults all routes to index.html in the directory set by setDirectory(). Treats the following file extensions as static files (non routeables):

  • html
  • js
  • json
  • csv
  • css
  • less
  • png
  • svg
  • eot
  • ttf
  • woff
  • appcache
  • jpg
  • jpeg
  • gif
  • ico

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',
  file: '/index.html'
});

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] [file]

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
      • optionally use server.port()
  • directory
    • the path to the directory where the static assets will be served
    • defaults to public
    • optionally use server.directory()
  • file
    • the file route to
    • defaults to /index.html
    • optionally use server.file()

pushstate-server's People

Contributors

iamruinous avatar insin avatar jtwg avatar ktrotter-verily avatar philipkobernik avatar scottcorgan avatar shemanaev avatar zigomir avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rubythonode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.