Skip to content

Latest commit

 

History

History
86 lines (56 loc) · 2.56 KB

index.md

File metadata and controls

86 lines (56 loc) · 2.56 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