Skip to content

Instantly share code, notes, and snippets.

@kadirpekel
Created October 6, 2010 21:01
Show Gist options
  • Save kadirpekel/614080 to your computer and use it in GitHub Desktop.
Save kadirpekel/614080 to your computer and use it in GitHub Desktop.
var meryl = require('meryl'),
connect = require('connect'),
merylex = require('meryl-extras'),
eco = require('eco'),
http = require('http');
var generictemplate = merylex('generictemplate');
http.createServer(
meryl
.plug(connect.logger())
.plug(connect.staticProvider())
.plug(generictemplate({templateExt: 'eco', renderFunc: eco.render}))
.handle('GET /({page}.html)?', function(req, resp) {
resp.render('home', {people: ['beaker', 'animal', 'kermit'],
page: req.params.page});
})
.cgi()
).listen(3000);
@kadirpekel
Copy link
Author

Note that the usage of Connect framework, method chaining, verbose method names, optional path variable sample and generic template from meryl-extras.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment