fixed glob example
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 5ea78cf · Browse files · 5 files·+54 added−52 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+54 added−52 removed
- tests:+2 added−1 removed
- other:+52 added−51 removed
Provenance
- Commit
aa4ec8f- Tree
d5ce9b3- Author
TJ Holowaychuk <tj@vision-media.ca>- Committer
TJ Holowaychuk <tj@vision-media.ca>- Parent
5ea78cf
5 files changed+54 added−52 removed
modified:examples/blog/models/post.js+1 added-1 removed
19 unmodified lines2021222324242526272839 unmodified lines19 unmodified lines if (!this.title) return fn(new Error('title required')); if (!this.body) return fn(new Error('body required')); if (this.body.length < 10) { return fn(new Error( 'body should be at least **10** characters long, was only ' + this.title.length)); 'body should be at least 10 characters long, was only ' + this.title.length)); } fn();};
39 unmodified linesdeleted:examples/blog/app.js-50 removed
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
/** * Module dependencies. */
var express = require('../../') , app = module.exports = express();
// config
app.set('views', __dirname + '/views');app.set('view engine', 'jade');
// middleware
app.configure('development',function(){ app.use(express.logger('dev'));})
app.configure(function(){ app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.cookieParser('keyboard cat')); app.use(express.session()); app.use(app.router); app.use(express.static(__dirname + '/public')); app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));});
// Locals
app.locals.use(function(req, res){ // expose "error" and "message" to all // views that are rendered. res.locals.error = req.session.error || ''; res.locals.message = req.session.message || ''; // remove them so they're not displayed on subsequent renders delete req.session.error; delete req.session.message;});
// Routes
require('./routes/site')(app);require('./routes/post')(app);
if (!module.parent) { app.listen(3000); console.log('Express started on port 3000');}No newline at end of fileadded:examples/blog/index.js+50 added
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
/** * Module dependencies. */
var express = require('../../') , app = module.exports = express();
// config
app.set('views', __dirname + '/views');app.set('view engine', 'jade');
// middleware
app.configure('development',function(){ app.use(express.logger('dev'));})
app.configure(function(){ app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.cookieParser('keyboard cat')); app.use(express.session()); app.use(app.router); app.use(express.static(__dirname + '/public')); app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));});
// Locals
app.locals.use(function(req, res){ // expose "error" and "message" to all // views that are rendered. res.locals.error = req.session.error || ''; res.locals.message = req.session.message || ''; // remove them so they're not displayed on subsequent renders delete req.session.error; delete req.session.message;});
// Routes
require('./routes/site')(app);require('./routes/post')(app);
if (!module.parent) { app.listen(3000); console.log('Express started on port 3000');}No newline at end of filemodified:test/acceptance/blog.js+2 added-1 removed
112345673 unmodified lines
var app = require('../../examples/blog/app')var app = require('../../examples/blog') , request = require('../support/http');
var authorization = 'Basic ' + Buffer('admin:express').toString('base64');
73 unmodified linesmodified:.gitignore+1 added
13 unmodified lines14 node_modules/15 testing16 .coverage_data17 cover_html18+test.js