group express middleware into layers
Last updated 8 years ago by hunterloftis .
Repository · Original npm · Tarball · package.json
$ cnpm install express-layers 
SYNC missed versions from official npm registry.

Express Layers

Easily group express middleware into named layers.


$ npm install express-layers



var express = require('express');
var layers = require('express-layers');

var app = express();
layers(app);  // adds app.lay()

app.lay('static');  // creates a layer
app.lay('static', express.static(path.join(__dirname, 'public'))); // adds middleware to a layer


// this will be executed before express.router
app.lay('static', express.static(path.join(__dirname, 'components', 'myComponent', 'public')));

Running Tests

$ npm install
$ make test

With Components

At Skookum, we organize node.js projects into components (components / feature groups / related user stories). A project might have components like: users, dashboard, marketing, errors, and admin.

In order to keep the components decoupled, each component is responsible for registering its own routes, controller actions, views, models, etc.

Using express-layers allows us to, for example, group all of the static middleware for different components into the same layer. Otherwise, routes for one component might intercept public files for another, since components are loaded one after another.

Current Tags

  • 0.0.1                                ...           latest (8 years ago)

1 Versions

  • 0.0.1                                ...           8 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © |