Skip to content

Commit

Permalink
fixing more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Mar 2, 2011
1 parent 6cae1f0 commit 66a6214
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions examples/form/app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

// Expose modules in ./support for demo purposes
require.paths.unshift(__dirname + '/../../support');

/**
* Module dependencies.
*/

var express = require('./../../lib/express'),
sys = require('sys');
var express = require('../../lib/express');

var app = express.createServer();

Expand Down
6 changes: 5 additions & 1 deletion examples/format/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

// Expose modules in ./support for demo purposes
require.paths.unshift(__dirname + '/../../support');

/**
* Module dependencies.
*/
Expand All @@ -18,7 +21,8 @@ var items = [
// Routes

app.get('/', function(req, res, next){
res.writeHead(200, { 'Content-Type': 'text/html' });
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html');
res.write('<p>Visit /item/2</p>');
res.write('<p>Visit /item/2.json</p>');
res.write('<p>Visit /item/2.xml</p>');
Expand Down
10 changes: 5 additions & 5 deletions examples/github/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require.paths.unshift(__dirname + '/../../support');
* Module dependencies.
*/

var express = require('./../../lib/express')
var express = require('../../lib/express')
, http = require('http');

var app = express.createServer();
Expand All @@ -27,10 +27,10 @@ app.set('view engine', 'jade');
function request(path, fn){
var client = http.createClient(80, 'github.com')
, req = client.request('GET', '/api/v2/json' + path, { Host: 'github.com' });
req.addListener('response', function(res){
req.on('response', function(res){
res.body = '';
res.addListener('data', function(chunk){ res.body += chunk; });
res.addListener('end', function(){
res.on('data', function(chunk){ res.body += chunk; });
res.on('end', function(){
try {
fn(null, JSON.parse(res.body));
} catch (err) {
Expand Down Expand Up @@ -109,7 +109,7 @@ app.get('/repos/*', function(req, res, next){
});

// Serve statics from ./public
app.use(express.staticProvider(__dirname + '/public'));
app.use(express.static(__dirname + '/public'));

// Listen on port 3000
app.listen(3000);
Expand Down

0 comments on commit 66a6214

Please sign in to comment.