Hello world working (somewhat)
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 a3aefb6 · Browse files · 5 files·+76 added−74 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+76 added−74 removed
- other:+76 added−74 removed
Provenance
- Commit
3043d1e- Tree
820b1f0- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
a3aefb6
5 files changed+76 added−74 removed
modified:examples/hello-world/app.js+8 added-16 removed
12345672345910111213141516176719891011
require.paths.unshift('lib')require('express') configure(function(){ set('root', __dirname)})/** * Module dependencies. */
get('/', function(){ this.render('front.html.ejs', { locals: { title: 'Hello World', name: 'Joe', items: ['one', 'two', 'three'] } })})var app = module.exports = require('express').createApplication();
run()No newline at end of fileapp.get('/', function(req, res){ res.writeHead(200, {}); res.end('Hello World');});No newline at end of filemodified:lib/express/core.js+1 added-39 removed
284 unmodified lines285 request.error(err)286 }287 })288 }289-})290-291-// --- Express292-293-Express = { 294- version: '0.14.0',295- config: [],296- routes: [],297- plugins: [],298- settings: {},299- params: {},300- server: new Server301-}302-303-// --- Defaults304-305-configure(function(){306- use(require('./plugins/view').View)307- use(require('./plugins/cache').Cache)308- use(require('./plugins/redirect').Redirect)309- use(require('./plugins/body-decoder').BodyDecoder)310-})311-312-configure('development', function(){313- enable('helpful 404')314- enable('show exceptions')315- enable('dump exceptions')316-})317-318-configure('test', function(){319- enable('throw exceptions')320- disable('dump exceptions')321-})322-323-configure('production', function(){324- enable('cache view contents')325- enable('cache view partials')326- enable('cache static files')327-})289+})added:lib/express/index.js+67 added
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
/*! * Express * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca> * MIT Licensed */
/** * Module dependencies. */
var sys = require('sys'), connect = require('connect'), rest = require('connect/providers/rest');
/** * Framework version. */
exports.version = '0.14.0';
/** * Configuration callbacks. */
exports.config = [];
/** * Initialize a new Application with optional middleware. * * @param {Array} middleware * @api public */
function Application(middleware){ this.routes = { get: [], post: [], put: [], del: []}; connect.Server.call(this, (middleware || []).concat([ { provider: 'rest', routes: this.routes } ]));}
sys.inherits(Application, connect.Server);
// Generate RESTful methods
(function(method){ Application.prototype[method] = function(path, fn){ var routes = {}; routes[method] = {}; routes[method][path] = fn; rest.normalize(routes); this.routes[method] = this.routes[method].concat(routes[method]); }; return arguments.callee;})('get')('post')('put')('del');
/** * Return a new application with optional middleware. * * @param {Array} middleware * @return {Application} * @api public */
exports.createApplication = function(middleware){ return new Application(middleware);};No newline at end of filedeleted:lib/express.js-18 removed
123456789101112131415161718
/*! * Express * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca> * MIT Licensed */
/** * Framework version. */
exports.version = '0.14.0';
/** * Configuration callbacks. */
exports.config = [];deleted:lib/index.js-1 removed
1express.jsNo newline at end of file