res.attachment Unicode filenames in Safariexpress:routerreq.params[name] from app.param()escape-html for HTML escapingvary module for res.varymax-age in Cache-Control in correct formatescape-html for escapingapp.set('etag', val)
app.set('etag', function(body, encoding){ return '"etag"' }) custom etag generationapp.set('etag', 'weak') weak tagapp.set('etag', 'strong') strong etagapp.set('etag', false) turn offapp.set('etag', true) standard etagres.send ETag as weak and reduce collisionsrouter.param() callbacksapp.VERB for the same path"
req.baseUrl to access the path stripped from req.url in routesapp.VERB for the same pathrouter.param() only when necessary instead of every matchapp.set('trust proxy', trust)
app.set('trust proxy', 1) trust first hopapp.set('trust proxy', 'loopback') trust loopback addressesapp.set('trust proxy', '10.0.0.1') trust single IPapp.set('trust proxy', '10.0.0.1/16') trust subnetapp.set('trust proxy', '10.0.0.1, 10.0.0.2') trust listapp.set('trust proxy', false) turn offapp.set('trust proxy', true) trust everythingcharset in Content-Type for res.sendapp.del() -- use app.delete() insteadres.json(obj, status) -- use res.json(status, obj) instead
res.json(status, num) requires res.status(status).json(num)res.jsonp(obj, status) -- use res.jsonp(status, obj) instead
res.jsonp(status, num) requires res.status(status).jsonp(num)req.next when inside router instanceETag header in HEAD requestsContent-Type for res.jsonpapp.purgerouter.purgeapp.allenable() methodreq.host for IPv6 literalsres.jsonp error if callback param is objectres.sendfile to sendres.header and res.setres.attachment and res.downloadsend modulemultipart as a shorthandexpress.createServer() - it has been deprecated for a long time. Use express()app.configure - use logic in your own app codeapp.router - is removedreq.auth - use basic-auth insteadreq.accepted* - use req.accepts*() insteadres.location - relative URL resolution is removedres.charset - include the charset in the content type when using res.set()staticapp.route -> app.mountpath when mounting an express app in another express appjson spaces no longer enabled by default in developmentreq.accepts* -> req.accepts*s - i.e. req.acceptsEncoding -> req.acceptsEncodingsreq.params is now an object instead of an arrayres.locals is no longer a function. It is a plain js object. Treat it as such.res.headerSent -> res.headersSent to match node.js ServerResponse objectreq.accepts* with acceptsreq.is with type-isapp.router() - returns the app Router instanceapp.route() - Proxy to the app's Router#route() method to create a new routeescape-html for HTML escapingvary module for res.varymethodOverride() -- use method-override module directlymax-age in Cache-Control in correct formatapp.set('etag', val)
app.set('etag', function(body, encoding){ return '"etag"' }) custom etag generationapp.set('etag', 'weak') weak tagapp.set('etag', 'strong') strong etagapp.set('etag', false) turn offapp.set('etag', true) standard etagres.send ETag as weak and reduce collisionsContent-Type for res.jsonpcharset in Content-Type for res.sendres.charset appending charset when content-type has oneapp.set('trust proxy', trust)
app.set('trust proxy', 1) trust first hopapp.set('trust proxy', 'loopback') trust loopback addressesapp.set('trust proxy', '10.0.0.1') trust single IPapp.set('trust proxy', '10.0.0.1/16') trust subnetapp.set('trust proxy', '10.0.0.1, 10.0.0.2') trust listapp.set('trust proxy', false) turn offapp.set('trust proxy', true) trust everythingres.headerSent -- use res.headersSentres.on("header") -- use on-headers module insteadres.appendHeader that would append in wrong orderapp.del() -- use app.delete() insteadres.json(obj, status) -- use res.json(status, obj) instead
res.json(status, num) requires res.status(status).json(num)res.jsonp(obj, status) -- use res.jsonp(status, obj) instead
res.jsonp(status, num) requires res.status(status).jsonp(num)app.purgerouter.purgeapp.allres.appendHeaderres.headerSent to return Booleanres.headersSent for node.js 0.8enable() methodreq.host for IPv6 literalsres.jsonp error if callback param is objectreq.subdomains when no Host is presentreq.host when no Host is present, return undefinedreq.hostres.set()req.subdomainsres.location(url) implementing res.redirect()-like setting of Locationreq.authres.cookie() options objectres.send() Etagsres.redirect()
for old browsers interpreting as htmlmake cleanreq.auth test coverageres.jsonp(). Closes #1374res.redirect() status. Closes #1336res.json() to retain previously defined Content-Types. Closes #1349res.redirect() to utilize a pathname-relative Location again. Closes #1382res.send()app.disable('x-powered-by'))res.jsonp(). Closes #1307connect.cookieParser() ("s:" prefix was missing) [tnydwrds]res.render() clobbering of "locals".createServer() & remove old stale examplesres.redirect() linkres.redirect("//foo.com")) supportexpress(1) -h flag, use -H for hogan. Closes #1245res.sendfile() socket error handling regressionsend() root normalization regressionerr.view property for view errors. Closes #1226res.sendfile() to use send() moduleres.send to use "response-send" moduleapp.locals.use and res.locals.use, use regular middlewareres.json(obj, status) support back for BCreq.authreq.range(size)res.links(obj)res.send(body, status) support back for backwards compat.default() support to res.format()req.freshres.send() freshness check, respect res.statusCode--hjs to express(1) [nullfirm]fresh depres.send() always checks freshness+ support to the routerreq.hostreq.param() to check route firstres.format() callback to override default 406 behaviourres.redirect() 406. Closes #1154req.ip{ signed: true } option to res.cookie()res.signedCookie()req.ipsreq.ips[] in jsonp callback. Closes #1128PORT env var support in generated template. Closes #1118 [benatkin]app.routes. Closes #887res.locals.use(). Closes #1120res.send()res.set() values to stringsstatic() in generated apps below routerres.send() only set ETag when not previously setmake test now runs unit / acceptance testsmake benchmark backres.send() support for String objectsres.header() and req.header() aliases for BCexpress.createServer() for BCexpressInit() middleware self-awareapp.locals.use(callback)app.locals objectapp.locals(obj)res.locals objectres.locals(obj)res.format() for content-negotiationapp.engine()res.cookie() JSON cookie supportreq.subdomainsreq.protocolreq.securereq.pathreq.ipsreq.freshreq.stalereq.accepts()res.set(obj)res.set(field, value)res.get(field)app.get(setting). Closes #842req.acceptsLanguage()req.acceptsCharset()req.acceptedreq.acceptedLanguagesreq.acceptedCharsetsres.redirect(). Closes #92--less support to express(1)express.response prototypeexpress.request prototypeexpress.application prototypeapp.path()app.render()res.type() to replace res.contentType()res.redirect() to add relative supportres.redirect('home') supportreq.notify()app.register()app.redirect()app.is()app.helpers()app.dynamicHelpers()res.sendfile() with non-GET. Closes #723express(1) generated app app.address() before listening [mmalecki]app.all duplicate DELETE requests [mscdex]filename on cached templates [matthewleon]express(1) eol on 0.4.x. Closes #947req.is() when a charset is presentmake test-cov since it wont work with node 0.5.xreq.pathres.redirect() HEAD support. [reported by xerox]req.flash(), only escape argsapp.routes.all(). Closes #803Route to use a single array of callbacksapp.param(). Closes #801
Closes #805qs >= 0.3.1res.redirect() on windows due to join() usage. Closes #808res.header() intention of a set, even when undefined*, value no longer requiredres.send(204) support. Closes #771status option special-case. Closes #739options.filename, exposing the view path to template enginesres.json() JSONP support. Closes #737app.configure() calls. Closes #735res.send() using res.json()path === null don't default itres.status(code)res.json(), an explicit version of res.send(obj)req.get(field, param)express(1) generated app outputs the envcontent-negotiation examplenpm testexpress(1)express(1) adds express as a depprepublishreq.route, exposing the current routeexpress(1)app.param() function for optional params. Closes #682../' inres.partial()` callsapp.options()Collection, ex: app.get('/user/:id').remove();app.param(fn) to define param logicapp.param() support for callback with return value.view as alias for .View./examples/sayres.sendfile() bug preventing the transfer of files with spacesapp.match() as app.match.all()app.lookup() as app.lookup.all()app.remove() for app.remove.all()app.remove.VERB()res.clearCookie()res.helpers() as alias of res.locals()res.send(). Closes #632. [Daniel * Dependency connect >= 1.4.0app.param() callbacks once per route middleware.
Closes #638res.download() connection errorsfilename option passing to template enginelayout(path) helper to change the layout within a view. Closes #610Fixed partial() collection object support.
Previously only anything with .length would work.
When .length is present one must still be aware of holes,
however now { collection: {foo: 'bar'}} is valid, exposes
keyInCollection and keysInCollection.
Performance improved with better view caching
Removed request and response locals
Changed; errorHandler page title is now Express instead of Connect
app.lookup.VERB(), ex app.lookup.put('/user/:id'). Closes #606app.match.VERB(), ex app.match.put('/user/12'). Closes #606app.VERB(path) as alias of app.lookup.VERB().connect >= 1.2.0err.view object when failing to locate a viewres.partial() call next(err) when no callback is given [reported by aheckmann]res.send(undefined) responds with 204 [aheckmann]<root>/_?<name> partial lookup support. Closes #447request, response, and app local variablessettings local variable, containing the app's settingsreq.flash() exception if req.session is not availableres.send(bool) support (json response)res.render()res.locals() without object returns the localsres.locals(obj) to compliment res.local(key, val)res.partial() callback supportres.render()partial() "locals" are now optionalSlowBuffer support. Closes #584 [reported by tyrda01]{req,res}.app reference when mounting [Ben Weaver]HTTPSServer constructorres.contentType() literal
The original res.contentType('.json'),
res.contentType('application/json'), and res.contentType('json')
will work now.res.render() status option support backres.render().charset support (via connect 1.0.4)./views/user/index.jade if you create
./views/user/layout.jade it will be used in favour of the root layout.res.redirect(). RFC states absolute url [reported by unlink]res.send() string charset to utf8Partial constructor (not currently used).locals support back to aid in migration processres.cookie() maxAge supportreq.header() Referrer / Referer special-case, either worksres.redirect(), now respects the mount-pointunion() util, taking place of merge(clone()) combores.local(name, val) for progressive view localsreq.param(name, default)app.disabled() and app.enabled()app.register() support for omitting leading ".", either worksres.partial(), using the same interface as partial() within a view. Closes #539app.param() to map route params to async/sync logicapp.helpers() as app.locals(). Closes #481res.contentType()cache views setting, defaulting to enabled in "production" envreq.accepts() support for extensionsres.download() and res.sendfile() now utilize Connect's
static file server connect.static.send().connect.utils.mime() with npm mime modulereq.query to be pre-defined (via middleware or other parentengine.render(str, options, callback), now engine.compile(str, options) -> Function, the returned function accepts fn(locals).req.param() bug returning Array.prototype methods. Closes #552Stream#pipe() instead of sys.pump() in res.sendfile()req.query to be pre-defined (via middleware or other parent app)render() setting inheritance.
Mounted apps would not inherit "view engine"view engine setting bug when period is in dirnamesession() callqs dependency to package.jsonrequire()s for latest connect supportconnect.routercreateServer()
previously the foo middleware passed to createServer(foo)
would not have access to Express methods such as res.send()
or props like req.query etc.partial('forum/post', postObject) will
give you the post object, providing a meaningful default.res.redirect() bodyres.redirect() supporting text/plain and text/html via Accept.req.is() to aid in content negotiationapp.all() support [thanks aheckmann]partial('user', user) providing the "user" local,
vs previously partial('user', { object: user }).partial() support for array-like collections. Closes #434res.sendfile() (and res.download() etc)express(1) generated app using 2 spaces instead of 4express(1) app generation. Closes #391app.flashFormattersres.sendfile() using sys.pump() when >= "stream threshold"res.sendfile()res.send() HEAD supportres.clearCookie()res.cookie()res.render() headers optionres.redirect() response bodiesres.render() status option support. Closes #425 [thanks aheckmann]res.sendfile() responding with 403 on malicious pathres.download() bug; when an error occurs remove Content-Dispositionres.send() 204. Closes #419res.header(). Closes #402listenFD() is called instead of listen(). [thanks guillermo]app.register() for template engine mapping. Closes #390res.render() callback support as second argument (no options)res.download()res.sendfile()express.middlewareName() vs connect.middlewareName()express(1) generated app. Closes #384res.sendfile() error handling, defer via next()res.render() callback when a layout is used [thanks guillermo]make install creating ~/.node_libraries when not presentAdded connect dependency to package.json
Removed "reload views" setting and support code development env never caches, production always caches.
Removed param in route callbacks, signature is now simply (req, res, next), previously (req, res, params, next). Use req.params for path captures, req.query for GET params.
Fixed "home" setting
Fixed middleware/router precedence issue. Closes #366
Fixed; configure() callbacks called immediately. Closes #368
Server constructorServer#helpers() for view localsServer#dynamicHelpers() for dynamic view locals. Closes #349Server#route for mounted apps. Closes #363res.render() exceptions, now passed to next() when no callback is given [thanks guillermo]Array checks, now Array.isArray()helpers export which act as additional local variablesmake install (for the executable)express executable for setting up simple app templatesAdded HTTP client query string support when method is GET. Closes #205
Added support for arbitrary view engines. For example "foo.engine.html" will now require('engine'), the exports from this module are cached after the first require().
Added async plugin support
Removed usage of RESTful route funcs as http client get() etc, use http.get() and friends
Removed custom exceptions
make init for submodulesmake init to work with older versions of gitmake test now builds libxmljs.node before testing