Node.js 开发者有福了!Express 3.0 发布 :chszs,转载需注明。
作者博客主页:http://blog.csdn.net/chszs
Express 3.0 是一个维护版本,针对 2.x 版修复了很多问题,并加入了很多新功能。
在使用 Express 框架时,要记住,Express 框架是帮助开发者快速实现 HTTP 通信相关的功能,而不是成为像 Rails 那样功能强大、全面的框架。
Connect 2.x
Changes introduced by Connect 2.x:
err.status support to Connect’s default end-point session() “proxy” setting to trust “X-Forwarded-Proto” okieSession() middleware compress(are for gzipped responses multipart() middleware json() middleware urlencoded() middleware limit option to the three above middleware fer option to multipart() to listen on formidable’s events added debug() instrumentation to aid in debugging basicAuth()’s req.remoteUser to req.user session() to only set-cookie on modification (hashed session json) changed bodyParser() to be an aggregate of json(), multipart() and urlencoded() 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 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.
作者:chszs,转载需注明。作者博客主页:http://blog.csdn.net/chszs
Express 3.x
Changes introduced by Express 3.x:
several new examples in ./examples unit testing for the examples (most of them at least) res.jsonp() to explicitly opt-in to JSONP support ETags and conditional-GET handling to res.send() responses “jsonp callback name” setting support for status code as first or second arg to res.send() and res.redirect() range(size) to parse Range header fields q.auth for basic auth links(obj) to set response the Link header field for pagination s.format(obj) for content-negotiation fresh for conditional-GETs req.stale for conditional-GETs mount-point relativredirection support to res.redirect() for the remote address (supporting reverse proxies) req.ips for remote address(es) (supporting reverse proxies) [] support in jsonp callback get(name) to compliment app.set(name, val) app.engine() to register template engines (replaces app.register()) subdomains to return an array of subdomains protocol to return the request protocol string (“http” or “https”) secure to assert that req.protocol is “https” path to return the parsed url’s pathname req.host to return hostname (Host void of port) debug() instrumentation to aid debugging () Language() sCharset() Languages req.acceptedCharsets 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) application prototype quest prototype express.response prototype app.render() for app-level templates added res.type() to replace old res.contentType()
{ signed: true } option to res.cookie() added async signature to res.render(), engines in consolidate.js work OOTB partial() movexpress-level layout support (engines provide similar) nam“case sensitive routes” to “case sensitive routing” res.signedCookie() “root” setting s.redirect("home") support req.notify() gister() redirect() is() 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.
相关热词搜索: 开发者 有福 发布