Node.js开发者有福了!Express 3.0发布

简介: Express 3.0是一个维护版本,针对2.x版修复了很多问题,并加入了很多新功能。 在使用Express框架时,要记住,Express框架是帮助开发者快速实现HTTP通信相关的功能,而不是成为像Rails那样功能强大、全面的框架。

Express 3.0是一个维护版本,针对2.x版修复了很多问题,并加入了很多新功能。


在使用Express框架时,要记住,Express框架是帮助开发者快速实现HTTP通信相关的功能,而不是成为像Rails那样功能强大、全面的框架。

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.

作者:chszs,转载需注明。作者博客主页:http://blog.csdn.net/chszs


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.
目录
相关文章
|
4天前
|
缓存 负载均衡 JavaScript
构建高效后端服务:Node.js与Express框架实践
在数字化时代的浪潮中,后端服务的重要性不言而喻。本文将通过深入浅出的方式介绍如何利用Node.js及其强大的Express框架来搭建一个高效的后端服务。我们将从零开始,逐步深入,不仅涉及基础的代码编写,更会探讨如何优化性能和处理高并发场景。无论你是后端新手还是希望提高现有技能的开发者,这篇文章都将为你提供宝贵的知识和启示。
|
21天前
|
JavaScript 中间件 关系型数据库
构建高效的后端服务:Node.js 与 Express 的实践指南
在后端开发领域,Node.js 与 Express 的组合因其轻量级和高效性而广受欢迎。本文将深入探讨如何利用这一组合构建高性能的后端服务。我们将从 Node.js 的事件驱动和非阻塞 I/O 模型出发,解释其如何优化网络请求处理。接着,通过 Express 框架的简洁 API,展示如何快速搭建 RESTful API。文章还将涉及中间件的使用,以及如何结合 MySQL 数据库进行数据操作。最后,我们将讨论性能优化技巧,包括异步编程模式和缓存策略,以确保服务的稳定性和扩展性。
|
16天前
|
Web App开发 JavaScript 前端开发
探索后端开发:Node.js与Express的完美结合
【10月更文挑战第33天】本文将带领读者深入了解Node.js和Express的强强联手,通过实际案例揭示它们如何简化后端开发流程,提升应用性能。我们将一起探索这两个技术的核心概念、优势以及它们如何共同作用于现代Web开发中。准备好,让我们一起开启这场技术之旅!
31 0
|
16天前
|
Web App开发 JavaScript 前端开发
构建高效后端服务:Node.js与Express框架的实践
【10月更文挑战第33天】在数字化时代的浪潮中,后端服务的效率和可靠性成为企业竞争的关键。本文将深入探讨如何利用Node.js和Express框架构建高效且易于维护的后端服务。通过实践案例和代码示例,我们将揭示这一组合如何简化开发流程、优化性能,并提升用户体验。无论你是初学者还是有经验的开发者,这篇文章都将为你提供宝贵的见解和实用技巧。
|
18天前
|
Web App开发 JavaScript 中间件
构建高效后端服务:Node.js与Express框架的融合之道
【10月更文挑战第31天】在追求快速、灵活和高效的后端开发领域,Node.js与Express框架的结合如同咖啡遇见了奶油——完美融合。本文将带你探索这一组合如何让后端服务搭建变得既轻松又充满乐趣,同时确保你的应用能够以光速运行。
24 0
|
4月前
|
JavaScript Java 测试技术
基于springboot+vue.js+uniapp的客户关系管理系统附带文章源码部署视频讲解等
基于springboot+vue.js+uniapp的客户关系管理系统附带文章源码部署视频讲解等
97 2
|
4月前
|
JavaScript Java 测试技术
基于springboot+vue.js+uniapp的小区物流配送系统附带文章源码部署视频讲解等
基于springboot+vue.js+uniapp的小区物流配送系统附带文章源码部署视频讲解等
130 4
|
4月前
|
JavaScript Java 测试技术
基于springboot+vue.js+uniapp的宠物援助平台附带文章源码部署视频讲解等
基于springboot+vue.js+uniapp的宠物援助平台附带文章源码部署视频讲解等
82 4
|
4月前
|
JavaScript Java 测试技术
基于springboot+vue.js+uniapp的宠物交易平台附带文章源码部署视频讲解等
基于springboot+vue.js+uniapp的宠物交易平台附带文章源码部署视频讲解等
75 4
|
4月前
|
JavaScript Java 测试技术
基于springboot+vue.js+uniapp的大学生入伍人员管理系统附带文章源码部署视频讲解等
基于springboot+vue.js+uniapp的大学生入伍人员管理系统附带文章源码部署视频讲解等
93 4
下一篇
无影云桌面