0.1.5 • Published 10 years ago
koa-mountify v0.1.5
koa-mountify
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-mountifyexample
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.jswill be mounted to/pathname/- module in
dirMUST retrun amiddlewareorarray of middleware.
develop
debug
$ DEBUG=koa-mountify node --harmony example/app.jstest
$ npm testcoverage
$ npm run coverlicense
MIT