Express 3.0

Express 3.0 is here (finally) and while it is mostly a refinement release, between it and Connect 2.x there are some helpful new features. Sorry for the massive delay! Been busy and wanted to get a reasonable amount of documentation up on expressjs.com before releasing, more docs will be coming soon.

Keep in mind that the goal of Express is to aid you with HTTP, not to become a framework super-power like Rails, so this update may be underwhelming to some since it’s merely a refinement.

Connect 2.x

Changes introduced by Connect 2.x:

  • added err.status support to Connect’s default end-point
  • added session() “proxy” setting to trust “X-Forwarded-Proto”
  • added cookieSession() middleware
  • added compress() middleware for gzipped responses
  • added multipart() middleware
  • added json() middleware
  • added urlencoded() middleware
  • added limit option to the three above middleware
  • added defer option to multipart() to listen on formidable’s events
  • added debug() instrumentation to aid in debugging
  • changed basicAuth()’s req.remoteUser to req.user
  • changed session() to only set-cookie on modification (hashed session json)
  • changed bodyParser() to be an aggregate of json(), multipart() and urlencoded()
  • moved many cookie-related utils into npm
  • moved static()’s logic into a separate npm module named “send”
  • increase perf ~%20 by memoizing url parsing
  • removed router() middleware
  • fixed default encoding for logger(), now “utf8” instead of “ascii”
  • fixed mount-path case-sensitivity

    Connect docs are available at http://www.senchalabs.org/connect/, and will eventually be mirrored on expressjs.com as well for convenience, along with usage guides.

Express 3.x

Changes introduced by Express 3.x:

  • added several new examples in ./examples
  • added unit testing for the examples (most of them at least)
  • added res.jsonp() to explicitly opt-in to JSONP support
  • added ETags and conditional-GET handling to res.send() responses
  • added “jsonp callback name” setting
  • added support for status code as first or second arg to res.send() and res.redirect()
  • added req.range(size) to parse Range header fields
  • added req.auth for basic auth
  • added res.links(obj) to set response the Link header field for pagination
  • added res.format(obj) for content-negotiation
  • added req.fresh for conditional-GETs
  • added req.stale for conditional-GETs
  • added mount-point relative redirection support to res.redirect()
  • added req.ip for the remote address (supporting reverse proxies)
  • added req.ips for remote address(es) (supporting reverse proxies)
  • added [] support in jsonp callback
  • added app.get(name) to compliment app.set(name, val)
  • added app.engine() to register template engines (replaces app.register())
  • added req.subdomains to return an array of subdomains
  • added req.protocol to return the request protocol string (“http” or “https”)
  • added req.secure to assert that req.protocol is “https”
  • added req.path to return the parsed url’s pathname
  • added req.host to return hostname (Host void of port)
  • added debug() instrumentation to aid debugging
  • added req.accepts()
  • added req.acceptsLanguage()
  • added req.acceptsCharset()
  • added req.accepted
  • added req.acceptedLanguages
  • added req.acceptedCharsets
  • added “json replacer” setting to manipulate json responses (remove private keys etc)
  • added “json spaces” setting to compress or expand json as you like (defaults to 2 in dev)
  • added express.application prototype
  • added express.request prototype
  • added express.response prototype
  • added app.render() for app-level templates
  • added res.type() to replace old res.contentType()
  • added { signed: true } option to res.cookie()
  • added async signature to res.render(), engines in consolidate.js work OOTB
  • removed partial()
  • removed express-level layout support (engines provide similar)
  • renamed “case sensitive routes” to “case sensitive routing”
  • removed res.signedCookie()
  • removed “root” setting
  • removed res.redirect('home') support
  • removed req.notify()
  • removed app.register()
  • removed app.redirect()
  • removed app.is()
  • removed app.helpers()
  • removed app.dynamicHelpers()

    Head over to the New Features in 3.x wiki page for a more comprehensive list of additions, or to 3.x migration to help you upgrade if you wish to do so.

Notes

  1. hermanjunge reblogged this from tjholowaychuk
  2. dordille reblogged this from tjholowaychuk
  3. prtcl reblogged this from tjholowaychuk
  4. reach1to1 reblogged this from tjholowaychuk
  5. nebjak reblogged this from tjholowaychuk
  6. soomtong reblogged this from tjholowaychuk
  7. hannjs reblogged this from tjholowaychuk and added:
    정식버전 등장..
  8. anandof86 reblogged this from tjholowaychuk
  9. uberscientist said: Thank you for your work!
  10. tjholowaychuk posted this