0.1.5 • Published 10 years ago

koa-mountify v0.1.5

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

koa-mountify

MIT license build status coverage status npm version npm download dependency status

Mount directory as middleware.

**/*.js will be required and mounted according to path.

Inspired by express-enrouten and koa-mount.

install

$ npm install --save koa-mountify

example

var koa = require("koa");
var app = koa();

var join = require("path").join;
var mountify = require("koa-mountify");
app.use(mountify(join(__dirname, "route")));

// similar to
// var mount = require("koa-mount");
// app.use(mount("/", require("./route/index")));
// app.use(mount("/foo", require("./route/foo")));
// app.use(mount("/foo/bar", require("./route/foo/bar")));

View the examples directory for working examples.

options

mountify(dir);
mountify(path, dir);
  • /pathname/index.js will be mounted to /pathname/
  • module in dir MUST retrun a middleware or array of middleware.

develop

debug

$ DEBUG=koa-mountify node --harmony example/app.js

test

$ npm test

coverage

$ npm run cover

license

MIT

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago