Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A razor-sharp DSL for Express inspired by Zappa.
CoffeeScript JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
test
.gitignore
.npmignore
.travis.yml
Cakefile
LICENSE
README.md
package.json

README.md

ex Build Status

Introduction

A razor-sharp DSL for express inspired by Zappa.

Install

npm install ex

Usage

Ex binds this to useful things and provides a few utility methods which are helpful. The simple ex app is probably:

require('ex') ->
  @get '/', ->
    @send 'hello world'

  @run()

The default express app could be rewritten like so:

ex = require 'ex'

ex ->
  # all environments
  @set 'port', process.env.PORT or 3000
  @set 'views', __dirname + '/views'
  @set 'view engine', 'jade'
  @use ex.favicon()
  @use ex.logger 'dev'
  @use ex.bodyParser()
  @use ex.methodOverride()
  @use @app.router
  @use ex.static __dirname + '/public'

  # development only
  @development ->
    @use ex.errorHandler()

  @get '/', ->
    @render 'index', title: 'Ex'

  @run =>
    console.log 'Ex listening on port ' + @get 'port'
Something went wrong with that request. Please try again.