High performance, high class web development for Node.js
migrate
Creating an HTTPS server is simply, simply pass the TLS options to express.createServer():
var app = express.createServer({
key: ...
, cert: ...
});
app.listen(443);
Previously if anyone was doing something similar to:
req.headers.referrer || req.headers.referer
req.header('Referrer') || req.header('Referer')
With the new special-case we may now simply use Referrer which will return either if defined:
req.header('Referrer')
Previously all local variables had to be passed to res.render(), or either app.helpers() or app.dynamicHelpers(), now we may do this at the request-level progressively. The res.local() method accepts a name and val, however the locals passed to res.render() will take precedence.
For example we may utilize this feature to create locals in middleware:
function loadUser(req, res, next) {
User.get(req.params.id, function(err, user){
res.local('user', user);
next();
});
}
app.get('/user/:id', loadUser, function(req, res){
res.render('user');
});