Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 24 lines (19 sloc) 0.664 kb
9cee56d0 » Simon Willison
2009-11-19 readme
1 djangode
2 ========
3
312ff2a4 » Simon Willison
2009-11-20 Added example.js and bulked out the readme a bit
4 Utility functions for node.js that imitate some useful concepts from Django.
9cee56d0 » Simon Willison
2009-11-19 readme
5
312ff2a4 » Simon Willison
2009-11-20 Added example.js and bulked out the readme a bit
6 http://nodejs.org/
7 http://www.djangoproject.com/
9cee56d0 » Simon Willison
2009-11-19 readme
8
312ff2a4 » Simon Willison
2009-11-20 Added example.js and bulked out the readme a bit
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.