layer-cake is a little node.js web framework care of your friends at MongoHQ.
The basic idea is to remove a lot of the normal boilerplate that goes into almost every express application, while adding some nice features to make your life easier.
$ npm install -g layer-cake
my-project|- app/| |- controllers/| | |- app_controller.coffee| |- initialize.coffee| |- middleware.coffee|- config/| |- server.json| |- development/| | |- mongodb.json| |- production/| | |- mongodb.json|- lib/|- package.json
All controllers are located in the
app/controllers directory. All files inside of this directory will
be required and then called, being passed the
app object. Controllers can then attach route handlers to
this object the same way they would to an express app.
For instance, the app_controller.coffee file could look like:
Middlewares work the exact same way they do in express. layer-cake will attempt to require a file at
app/middleware and then pass the
app object to it.
A simple middleware.coffee might look like this:
express = require 'express'=appuse expressloggerappuse expressbodyParserappuse expressmethodOverrideappuse approuter
All configuration is located in the config directory. All
.yaml files will be parsed
and made available on the
app.config object. Any configuration files in an environment-specific directory
will override files from the main config directory. The current environment is read from
and will always default to
For instance, the above directory structure will result in
app.config looking like this in development:
"server":// contents of my-project/app/config/server.json"mongodb":// contents of my-project/app/config/development/mongodb.json
Copyright (c) 2013 MongoHQ Inc. Licensed under the MIT license.