Skip to content
This repository
tag: v0.2.1
Fetching contributors…

Cannot retrieve contributors at this time

file 86 lines (56 sloc) 2.617 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'

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

at 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

Something went wrong with that request. Please try again.