docs
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 c4432ee · Browse files · 4 files·+17 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+17 added−9 removed
- other:+17 added−9 removed
Provenance
- Commit
6cae1f0- Tree
4a1d448- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
c4432ee
4 files changed+17 added−9 removed
modified:examples/ejs/app.js+1 added-1 removed
4 unmodified lines5678991011121316 unmodified lines4 unmodified lines/** * Module dependencies. */
var express = require('./../../lib/express');var express = require('../../lib/express');
var app = express.createServer();
// Optional since express defaults to CWD/views16 unmodified linesmodified:examples/error/app.js+5 added-2 removed
1234567869101112138 unmodified lines2223242523262728
// Expose modules in ./support for demo purposesrequire.paths.unshift(__dirname + '/../../support');
/** * Module dependencies. */
var express = require('./../../lib/express');var express = require('../../lib/express');
var app = express.createServer();
app.get('/', function(req, res){8 unmodified lines
// The errorHandler middleware in this case will dump exceptions to stderr// as well as show the stack trace in responses, currently handles text/plain,// text/html, and application/json responses to aid in developmentapp.use('/', express.errorHandler({ dumpExceptions: true, showStack: true }));app.use('/', express.errorHandler({ dump: true, stack: true }));
app.listen(3000);No newline at end of fileNo newline at end of filemodified:examples/error-pages/app.js+6 added-6 removed
4 unmodified lines5678991011121349 unmodified lines63646566676869707167686970717273747521 unmodified lines4 unmodified lines/** * Module dependencies. */
var express = require('./../../lib/express');var express = require('../../lib/express');
var app = express.createServer();
// Serve default connect favicon49 unmodified lines// configure() blocks to provide introspection when// in the development environment.
app.error(function(err, req, res, next){ if (err instanceof NotFound) { res.render('404.jade', { status: 404, error: err }); } else { next(err); } if (err instanceof NotFound) { res.render('404.jade', { status: 404, error: err }); } else { next(err); }});
// Here we assume all errors as 500 for the simplicity of// this demo, however you can choose whatever you like21 unmodified linesmodified:examples/flash/app.js+5 added
26 unmodified lines27 // template, "messages" will be populated with the return28 // value of this function.29 30 app.dynamicHelpers({31+ // as an alternative to this install the 32+ // express-messages helper via npm33+ // 34+ // $ npm install express-messages35+ //36 messages: function(req, res){37 // In the case of flash messages38 // we return a function, allowing39 // flash messages to only be flushed44 unmodified lines