Negatory. Postpone Mission.
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

koa-spankular

0.0.1 • Public • Published

koa-spankular

Über simple middleware for serving a static file with pushState support. Tested on a stack of Koa, Angular, & ui-router.

Should hopefully work with other likeminded frameworks without too much fuzz : )

Installation

$ npm install koa-spankular

Options

The following options are available (and required):

  • dir - the location of your static file.
  • file - the name + extension of your static file.
  • routes - an array of strings matching the routes you wish to serve the static file.

Example

var spank = require('koa-spankular');
var koa = require('koa');
var app = koa();
 
var routes = ["/", "/users", "/about", "/contact"];
 
// app.use(spank(dir, { file: file, routes: routes });
 
app.use(spank((__dirname + '/public/'), {
   file: 'index.html',
   routes: routes
}));
 
app.listen(9000);

License

MIT

Keywords

none

install

npm i koa-spankular

Downloadsweekly downloads

3

version

0.0.1

license

none

last publish

collaborators

  • avatar