Skip to content
Myr

fixing more examples

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 6cae1f0 · Browse files · 3 files+14 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+14 added−8 removed

  • other:+14 added−8 removed

3 files+14 added−8 removed

modified:examples/form/app.js+4 added-2 removed
modified:examples/format/app.js+5 added-1 removed
modified:examples/github/app.js+5 added-5 removed
4 unmodified lines
5/**6 * Module dependencies.7 */89var express = require('./../../lib/express')9var express = require('../../lib/express')10 , http = require('http');1112var app = express.createServer();13
12 unmodified lines
2627function request(path, fn){28 var client = http.createClient(80, 'github.com')29 , req = client.request('GET', '/api/v2/json' + path, { Host: 'github.com' });30 req.addListener('response', function(res){30 req.on('response', function(res){31 res.body = '';32 res.addListener('data', function(chunk){ res.body += chunk; });33 res.addListener('end', function(){32 res.on('data', function(chunk){ res.body += chunk; });33 res.on('end', function(){34 try {35 fn(null, JSON.parse(res.body));36 } catch (err) {37 fn(err);
70 unmodified lines
108 })(names.shift());109});110111// Serve statics from ./public112app.use(express.staticProvider(__dirname + '/public'));112app.use(express.static(__dirname + '/public'));113114// Listen on port 3000115app.listen(3000);116console.log('Express app started on port 3000');