0.3.0 • Published 10 years ago

sp-server v0.3.0

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

sp-server

Node.js simple Single Page Server

Installation

Just use npm install

npm install sp-server

Usage

Follow example

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

server('./build', 'index.html')
  .on('/', function (page, params, callback) {
    callback(page.replace('<!-- OPENGRAPH -->', opengraph));
  })
  .on('/:id', function (page, params, callback) {
    console.log(params); // {id: 123}
    callback(page);
  })
  .start(8080)
;

Description of parameters in function

  • page - content page of index.html placed in ./build
  • params - matched params with RegExp
  • callback - callback function to be called when all is done, applies string to response
0.3.0

10 years ago

0.2.0

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago