Express 3.0釋出
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.
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.
在使用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.
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.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-747274/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Spring Boot 3.0正式釋出Spring Boot
- Vue 3.0-beta.1 釋出!Vue
- FlutterBoost3.0釋出preview版本FlutterView
- Hyperf 3.0 釋出,PHP 新時代PHP
- 重磅升級!TDengine3.0 正式釋出
- Apache Spark 3.0 預覽版正式釋出,多項重大功能釋出ApacheSpark
- Dio 3.0釋出,支援Flutter Web 和 Http/2.0FlutterWebHTTP
- 雲原生週刊:Prometheus 3.0 Beta 釋出|2024.09.16Prometheus
- React Suite v3.0 正式版釋出ReactUI
- 它來了!Flutter3.0釋出全解析Flutter
- vue-cli 3.0 下釋出一個 TypeScript 元件VueTypeScript元件
- 開源 CMS Ghost 3.0 釋出,帶來新功能
- Node + Express 後臺開發 —— 上傳、下載和釋出Express
- 尤雨溪:Vue3.0正式全球釋出會_2020Vue
- Vue 3.0 Beta 版本釋出,你還學的動麼?Vue
- 棄用Java 8,Apache Kafka釋出3.0正式版JavaApacheKafka
- SpringBoot 3.0正式釋出,有這幾個新變化!Spring Boot
- Vue 2.6 釋出:新語法、效能改進、向 3.0 看齊Vue
- .NET靜態程式碼織入——肉夾饃(Rougamo)釋出3.0GAM
- DevSecOps敏捷安全技術金字塔V3.0正式釋出dev敏捷
- DevSecOps 敏捷安全技術金字塔 V3.0 正式釋出dev敏捷
- vue+nuxt+scss+node+express+MongoDB 實現的簡單文章釋出系統VueUXCSSExpressMongoDB
- JNPF快速開發平臺3.0版本即將重磅釋出
- 重磅釋出 | FISCO BCOS v3.0核心特性與技術實現
- DevEco Device Tool 3.0 Release 新版本釋出,支援多人共享開發dev
- 十年再出發,Dubbo 3.0 Preview 即將在 3 月釋出View
- [譯] jQuery 3.0 終於釋出了jQuery
- iView 釋出 3.0 版本,以及開發者社群等 5 款新產品View
- 一文看盡中亦科技EVO-ITSM 3.0新品釋出會
- TDengine 3.0 重磅釋出,首屆開發者大會圓滿結束
- TDengine 3.0 重磅釋出,首屆 TDengine 開發者大會圓滿落幕
- 2022年11月將釋出基於Java17的Spring Boot 3.0JavaSpring Boot
- 厚積薄發,綠盟科技智慧安全3.0理念體系正式釋出
- 全新 Amazon S3 Express One Zone 高效能儲存類服務,震撼釋出!S3Express
- Laravel Excel3.0匯出LaravelExcel
- 阿里雲EDAS 3.0重磅釋出,無侵入構建雲原生應用阿里
- EMQX Enterprise 4.4.12&4.4.13 釋出:叢集負載重平衡、TDengine 3.0 適配MQ負載
- 痞子衡嵌入式:MCUBootUtility v3.0釋出,開始支援LPC, Kinetis啦boot
- CAT 3.0 開源釋出,支援多語言客戶端及多項效能提升客戶端