forked from expressjs/express
-
Notifications
You must be signed in to change notification settings - Fork 0
Migrating from 2.x to 3.x
visionmedia edited this page Nov 10, 2011
·
33 revisions
-
res.render()"status" option (useres.statusCode=) -
res.render()"charset" option (useres.charset=) -
app.dynamicHelpers()(useapp.locals.use(callback)) -
app.helpers()(useapp.locals) -
app.VERB(path)for route lookup - the concept of a "layout" (template engine specific now)
-
partial()(template engine specific) res.partial()- "view options" setting, use
app.locals - "hints" setting
-
req.isXMLHttpRequest(usereq.xhr) -
app.error()(use middleware with (err, req, res, next))
-
res.send(body[, code])is nowres.send([code,] body) -
res.redirect(url[, code])is nowres.redirect([code,] url) -
res.json(obj[, code])is now `res.json([code,] obj) - renamed
app.register()toapp.engine()
- app "root" setting
-
app.get(setting)=> value -
req.secureto check if the request was made via HTTPS -
req.pathto grab the url pathname -
res.set(field, value)to set a header field value -
res.set(obj)to set several values res.locals.NAME = val-
res.locals(obj)to set several locals app.locals.NAME = val-
app.locals(obj)to set several app-level locals app.render()-
res.type()alias ofres.contentType() -
res.clearCookie()"path" defaults to the "root" setting -
res.cookie()"path" defaults to the "root" setting res.headerSentres.charset=req.stalereq.fresh- JSON cookie support
- signed cookie support
- several subtle
res.sendfile()bugs