I'm disappointed that this is mostly a joke. I really like the docs and have been looking for something along these lines lately.
Maurice also wrote Coffeekup[2] (a Coffeescript Jade) which has also been taken over by the community as a project called Coffeecup[3].
(Sincerely hope Maurice is ok. He was real active and put a lot of effort into his projects up until his disappearance.)
[0]: http://zappajs.org/docs/crashcourse/
[1]: http://twitter.com/mauricemach
[2]: http://coffeekup.org/ && https://github.com/mauricemach/coffeekup
[3]: https://github.com/gradus/coffeecup db = require('./your_sexy_data_access_module')
server = require('lazorse').server port: 3000, ->
# in this context we register resources the app using @resource
@resource '/things/{thingId}':
shortName: "Things"
GET: ->
db.getThing @thingId, @data
POST: ->
db.getThing @thingId, (err, thing) =>
return @next(err) if err
thing.update(@req, @data)
Where @data is node-style callback function taking (err, data), and the data will be rendered by a separate middleware layer that inspects Accept headers and does the Right Thing.There's a lot more than should be covered in an HN comment, but in interest of DRYing out the above example, let's rewrite it to use a coercion to retrieve "thing" instances.
db = require('./your_sexy_data_access_module')
server = require('lazorse').server port: 3000, ->
@coerce 'thing', "Things are whatever this app deals in", db.getThing
@resource '/things/{thing}':
shortName: "Things"
GET: ->
# Use @ok because we won't get here if there was an error retrieving
# the thing
@ok @thing
POST: ->
@thing.update @req, @data
See http://betsmartmedia.github.com/Lazorse for full API docs and examples. Bug reports, pull requests, flame comments etc. are all very welcome :)This much:
var app = require('express')(); app.get('*', function(req, res) { res.send('hello world'); }); app.listen(8080);
Hello world probably a bad example.