azat-co / expressjsguide Goto Github PK
View Code? Open in Web Editor NEWExpress.js Guide code examples
Express.js Guide code examples
"Query string everything to the left of the question mark"
This should be everything to the right of the question mark.
PDF p23; I was confused by "up-time" module. If I go to the GitHub repo/npm, the package seems to have a "This project is deprecated" message.
Clicking through the article makes it worse as it seems that the "up" module name was recycled into something completely different.
per http://npmjs.org/doc/misc/npm-faq.html#Is-it-npm-or-NPM-or-Npm
npm should never be capitalized unless it is being displayed in a location that is customarily all-caps (such as the title of man pages.)
The string:
express.cookierParser('some secret string')
should be:
express.cookieParser('some secret string')
This is to report that your jade template on page 27 of your Express guide should not declare doctype 5 anymore but doctype html.
As doctype 5 was set deprecated - see expressjs/express#1931
On the lower half of the page, there is the following snippet of code:
module.exports = {
stories: require('./stories'),
users: require('./users)
};
It is missing a closing apostrophe for the argument of the second call to require.
These short snippets are not in Github for pull requests, right?
on page 28
• 1 app.disable('etag');
• 2 console.log(app.disabled('etab'));
The latter should read ‘etag’ most probably...
on page 29
view engine holds the template file extension, e.g., ‘ext’ or ‘jade’, to utilize if the file extension is not passed to the res.render() function inside of the request handler.
here ‘ext’ should read ‘ejs’ I suppose...
Just let me know if such corrections are just creepy or useful to you...
In the book, Chapter 15, Page 53 - This code :
var authAdmin = function(req,res,next){ ...
}
var getUsers = function(req,res,next){
...
return next();
return next();
}
var renderUsers = function(req,res){
}
var admin = [ authAdmin, getUsers, renderUsers ];
app.get('/admin', authAdmin, getUsers, renderUsers);
should actually be :
var authAdmin = function(req,res,next){ ...
}
var getUsers = function(req,res,next){
...
return next();
return next();
}
var renderUsers = function(req,res){
}
var admin = [ authAdmin, getUsers, renderUsers ];
app.get('/admin', admin);
I'd do a pull request, but I can't find that in the actual code. I think it's just a snippet from the book.
I would also let you know that there's a typo in the code at page 50 and 52 (I'm talking about the pdf version), when you pass multiple middleware functions at the same route
app.get('/api/v1/stories/:id',function(req,res,next) {
// ...
}), <- the round bracket should not close here
// ...
});
Hope this helps, keep up the good work :-)
var stories = require.('./route/stories');
var users = require.('./route/users');
Should be:
var stories = require('./route/stories');
var users = require('./route/users');
app.use(express.logger()); //vanilla logger
app.use(express.logger('short'));
app.use(express.logger('dev')
missed round bracket
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.