simonw / djangode
- Source
- Commits
- Network (8)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
djangode /
| name | age | message | |
|---|---|---|---|
| |
README.txt | Fri Nov 20 02:06:16 -0800 2009 | |
| |
djangode.js | Fri Nov 27 16:05:40 -0800 2009 | |
| |
example.js | Fri Nov 27 16:12:28 -0800 2009 | |
| |
static-demo/ | Fri Nov 20 02:06:16 -0800 2009 |
README.txt
djangode
========
Utility functions for node.js that imitate some useful concepts from Django.
http://nodejs.org/
http://www.djangoproject.com/
Example usage:
var dj = require('./djangode');
dj.serve(dj.makeApp([
['^/$', function(req, res) {
dj.respond(res, '<h1>Homepage</h1>');
}],
['^/other$', function(req, res) {
dj.respond(res, '<h1>Other page</h1>');
}],
['^/page/(\\d+)$', function(req, res, page) {
dj.respond(res, '<h1>Page ' + page + '</h1>');
}]
]), 8008); // Serves on port 8008
Run "node example.js" for a slightly more interesting example.
