Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 25 lines (19 sloc) 0.664 kB
9cee56d readme
Simon Willison authored
1 djangode
2 ========
3
312ff2a Added example.js and bulked out the readme a bit
Simon Willison authored
4 Utility functions for node.js that imitate some useful concepts from Django.
9cee56d readme
Simon Willison authored
5
312ff2a Added example.js and bulked out the readme a bit
Simon Willison authored
6 http://nodejs.org/
7 http://www.djangoproject.com/
9cee56d readme
Simon Willison authored
8
312ff2a Added example.js and bulked out the readme a bit
Simon Willison authored
9 Example usage:
10
11 var dj = require('./djangode');
12 dj.serve(dj.makeApp([
13 ['^/$', function(req, res) {
14 dj.respond(res, '<h1>Homepage</h1>');
15 }],
16 ['^/other$', function(req, res) {
17 dj.respond(res, '<h1>Other page</h1>');
18 }],
19 ['^/page/(\\d+)$', function(req, res, page) {
20 dj.respond(res, '<h1>Page ' + page + '</h1>');
21 }]
22 ]), 8008); // Serves on port 8008
23
24 Run "node example.js" for a slightly more interesting example.
Something went wrong with that request. Please try again.