作者:chszs,转载需注明。
作者博客主页:http://blog.csdn.net/chszs
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.
分享到:
相关推荐
"Node.js开发者技术路线2019年新发布"是一份旨在帮助开发者规划学习路径,提升Node.js技能的专业指南。这份路线图覆盖了从基础到高级的各种主题,涵盖了成为一名合格甚至优秀的Node.js开发人员所需掌握的所有关键...
该项目是一个基于Node.js的Tencent Cloud API 3.0 TypeScript SDK设计源码,包含3610个文件,其中2209个为TypeScript文件,1391个为JavaScript文件,并包含少量的Markdown、JSON、Git忽略、LICENSE、Protocol缓冲区...
Node.js是一个基于Chrome V8引擎的JavaScript运行环境,它允许开发者在服务器端使用JavaScript,实现了JavaScript的全栈开发能力。Node.js拥有异步、非阻塞I/O模型,使其在处理高并发场景时表现出色。在这个项目中,...
这是 ShowMeAI 持续分享的速查表系列!本速查表是《Node.js开发者学习路线图》,是 Node.js 语言开发者的成长路线图,包括中文版本和英文版本。内容丰富,脉络清晰,可视化效果很酷炫!值得下载和收藏~
在本文中,我们将深入探讨如何使用Node.js、Vue 3.0、Express和MySQL搭建一个基础的开发环境。首先,让我们分别了解这些技术的核心概念。 **Node.js** 是一个基于Chrome V8引擎的JavaScript运行环境,它允许开发者...
Node.js 是一个开源、跨平台的 JavaScript 运行环境,它允许开发者在服务器端执行 JavaScript 代码。Node.js 使用 V8 引擎,这是 Google 为 Chrome 浏览器开发的高性能 JavaScript 和 WebAssembly 引擎。Node.js 的...
Node.js 是一个基于 JavaScript 的服务器端运行平台,允许开发者使用 JavaScript 语言来编写服务器端应用程序。 Node.js 的出现使得 JavaScript 成为服务器端脚本语言。 Node.js 的主要特点是非阻塞 I/O 和事件驱动...
Node.js 是一个开源、跨平台的 JavaScript 运行环境,它让开发者可以在服务器端执行 JavaScript 代码。Node.js 使用了 Google V8 引擎,这个引擎是为 Chrome 浏览器设计的,因此 Node.js 具有高性能和高效性的特点。...
而ThinkJS是一个基于Node.js的MVC(Model-View-Controller)框架,它提供了强大的功能和优秀的开发体验,尤其在ThinkJS3.0版本中,更是强化了模块化、中间件机制以及性能优化,让开发者能够更高效地构建大型Web应用...
Node.js是一个开放源码、跨平台的JavaScript运行环境,它允许开发者在服务器端运行JavaScript代码。Express是基于Node.js的一个Web应用框架,极大地简化了构建Web应用的过程。 ### 1. Node.js安装 首先,你需要在你...
Node.js是一个基于Chrome V8引擎的JavaScript运行环境,用于构建高性能的网络应用。在本系统中,Node.js作为后端服务器,处理来自微信小程序的请求,执行业务逻辑,并返回相应的数据。其非阻塞I/O模型和事件驱动特性...
Node.js是一个基于JavaScript的runtime环境,提供了一个事件驱动、非阻塞I/O模型,使得开发者可以轻松地构建高性能的网络应用程序。 在Linux系统中安装Node.js需要经过以下步骤: 1. 从Node.js官网下载Node.js...
Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,它允许开发者在服务器端使用 JavaScript 进行编程。Node.js 提供了一个丰富的生态系统,包含了大量的开源库和工具,使得开发网络应用变得更加便捷。在...
Node.js是一种开源、跨平台的JavaScript运行环境,它允许开发者在服务器端运行JavaScript代码,极大地扩展了JavaScript的应用领域。Node.js基于Chrome V8引擎,因此它具有高性能和高效的特性。标题提到的是Node.js的...
Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,它让开发者能够在服务器端使用 JavaScript 进行编程。而 Clusterluck 是一个专为 Node.js 设计的库,它的目标是模仿 Erlang 语言的某些特性,尤其是其在...
Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,它让开发者能够在服务器端使用 JavaScript,极大地推动了前端开发的进步。版本 16.12.0 是 Node.js 的一个重要更新,包含了多项性能优化和新特性的引入,...
【标题】"express-todolist_nodejs_Node.js_goodgka_express列表_" 指的是一款使用Node.js和Express框架构建的待办事项(Todo List)应用。这个项目旨在展示如何利用这两个技术来创建一个简单的前端列表展示页面,让...