Enable Express js to handle unRESTful route objects
CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
.npmignore
.travis.yml
Cakefile
LICENSE
README.md
package.json

README.md

Handler

Handler is a tiny node module that all it does is monkey-patches Express, allowing you to write unRESTful route objects Handler is written in coffeescript by Marcel Miranda.

Source Code

Installation

npm install handler

Usage

# First require express then handler
require 'express'
require 'handler'

# Create express app
app = express.createServer()

# Then user handler
app.handler 'admin',
  dashboard: (req, res) -> ...
  user:
    get: (req, res) -> ...
    post: (req, res) -> ...

  # Which would be equivalent to
  app.get 'admin/dashboard', (req, res) -> ...
  app.get 'admin/user', (req, res) -> ...
  app.post 'admin/user', (req, res) -> ...

Copyright © 2012 Marcel Miranda. See LICENSE for further details.