Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Created February 7, 2010 07:46
Show Gist options
  • Save tim-smart/297297 to your computer and use it in GitHub Desktop.
Save tim-smart/297297 to your computer and use it in GitHub Desktop.
HTTP({
host: '127.0.0.1',
post: 8000,
routes: [{
match: /^\/myroute/,
callback: function(request) {}
}, {
match: {
type: 'POST',
rule: /^\/myroute/
},
callback: function() {}
},
['/myroute', function() {}],
['HEAD', '/myroute', function() {}], {
match: [{
type: 'POST',
rule: [/^\/myroute/, '/myroute']
}, {
rule: '/another'
}],
callback: function() {}
}],
callback: function() {
// Handle 404's etc in here
// If not specified, framework will
// Auto-generate error page
}
});
// Same deal for other protocols
// This case raw tcp
TCP({
...
});
// Websocket etc etc
// Can define more protocols in plugins
WS({});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment