Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

86 lines (56 sloc) 2.628 kb
layout title
default
Radically focused, CoffeeScript-oriented interface for building web apps on Node.js with Express and Socket.IO.

Node development for the lazy

Zappa is a radically focused, CoffeeScript-oriented interface for building web apps on Node.js with Express and Socket.IO.

It turns this:

{% highlight coffeescript %} app = require('express').createServer() io = require('socket.io').listen(app)

app.use express.bodyParser() app.use express.methodOverride() app.use app.router app.use express.static __dirname + '/public'

app.configure 'development', -> app.use express.errorHandler dumpExceptions: on

app.configure 'production', -> app.use express.errorHandler()

app.get '/:foo', (req, res) -> req.params.foo += 'bar' res.render 'index', foo: req.params.foo

io.sockets.on 'connection', (socket) -> socket.emit 'welcome', time: new Date()

socket.on 'shout', (data) -> socket.broadcast.emit 'shout', id: socket.id, text: data.text

app.listen 3000 {% endhighlight %}

Into this:

{% highlight coffeescript %} require('zappa') -> @use 'bodyParser', 'methodOverride', @app.router, 'static'

@configure development: => @use errorHandler: {dumpExceptions: on} production: => @use 'errorHandler'

@get '/:foo': -> @foo += 'bar' @render 'index'

@on connection: -> @emit 'welcome', time: new Date()

@on shout: -> @broadcast 'shout', {id, @text} {% endhighlight %}

Learn More

Other resources

  • The source code repository at github

  • Questions, suggestions? Drop us a line on the mailing list

  • Rather do it realtime? Join the IRC channel on freenode: [#zappajs]((irc://irc.freenode.net/zappajs)

  • Found a bug? Open an issue at github

  • Check the project's history at the change log

  • Migrating from 0.1.x? See what changed in v0.2.x, and follow the quick guide

  • Deploying to heroku? Check this blog post

Jump to Line
Something went wrong with that request. Please try again.