Find file
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (40 sloc) 1.06 KB

ex Build Status


A razor-sharp DSL for express inspired by Zappa.


npm install ex


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'


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'