forked from expressjs/express
-
Notifications
You must be signed in to change notification settings - Fork 0
New features in 3.x
visionmedia edited this page Apr 13, 2012
·
15 revisions
-
app.head()support -
app.locals.use(callback)view-specific parallel middleware to expose dynamic local variables -
app.render(name[, options], callback)to render app-level views
-
trust proxysetting enables the use of "X-Forwarded-Proto" forreq.protocolandres.redirecturl construction -
json spacessetting enables the developer to decide isres.json()responds with nicely formatted JSON or compact json (this value is passed toJSON.stringify()) -
json replacersetting is a callback which is passed toJSON.stringify()inres.json()allowing you to manipulate and filter the JSON response
-
req.protocolreturns the protocol string "http" or "https" (supports X-Forwarded-Proto viatrust proxysetting) -
req.get(field)gets a request header field value (req.get('Host')) -
req.accepts(type)improved -
req.acceptedarray of parsed Accept values sorted by quality -
req.acceptsCharset(charset)added -
req.acceptedCharsetsarray of parsed Accept-Charset values sorted by quality -
req.acceptsLanguage(lang)added -
req.acceptedLanguagesarray of parsed Accept-Language values sorted by quality -
req.signedCookiesobject containing signed cookies -
req.staleto see if a request is stale (based on ETag/Last-Modified) -
req.freshto complimentreq.stale
-
res.get(field)gets a response header field value (res.get('Content-Length')) -
res.set(field, value)sets a response header field (res.set('Content-Length', n)) -
res.cache(str[, options])Cache-Control helper -
res.signedCookie()set a signed cookie -
res.set(field, value)set field value -
res.set(obj)set several field values -
res.type(path)alias of previousres.contentType(path), allowsres.type('json'),res.type('application/x-whatever') -
res.redirect()relative support (res.redirect('../new'),res.redirect('./edit'), etc) -
res.respondTo(types)to format responses based on qvalue-sorted Accept - JSON cookie support