Node.js 服務端框架,?Hapi.js 12.0.0 發布

碼頭工人 8年前發布 | 5K 次閱讀 ?Hapi.js

Hapi.js 是一個用來構建基于 Node.js 的應用和服務的富框架,使得開發者把重點放在便攜可重用的應用邏輯而不是構建架構。內建輸入驗證、緩存、認證和其他 Web 應用開發常用的功能。

hapi v12.0.0 主要移除了 qs 模塊的框架依賴。qs 是一個 URL 查詢字符串解析器,支持特定的復雜結構。此版本最大的貢獻者是 Sideway

非兼容改進:

  • Removed support for the processing of special form-encoded key=value pairs in query strings, form-encoded payloads, and multipart field names.

  • Removes the connection query.qs configuration option.

  • Removes the route payload.qs configuration option.

  • Removes the parserOptions argument from the request.setUrl() method.

  • Authentication scope strings cannot begin with ! or + as those prefix characters now have a special meaning.

  • request.route (the route public interfacesettings.auth changed to move scope andentity inside a new access array.

  • When using server.inject(), any HTTP trailers are no longer included in res.headersbut instead are provided under res.trailers to be consistent with node.

  • Removed request.session and request.auth.session placeholders (was set to nullbefore).

新特性:

  • Allow passing a pre-processed URL object (from node's URL parse()) torequest.setUrl().

  • Support new required and forbidden authentication scopes.

  • Allow specifying multiple scope/entity sets for a single endpoint.

  • New pendingGenerateTimeout cache option for reducing calls to the generate method while another is already pending.

  • Return a Promise when a callback is not provided.

  • Expose CORS origin match status in request.info.cors.isOriginMatch.

  • Expose entire request.auth object in validation context.

詳細改進內容請看發行說明

 本文由用戶 碼頭工人 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!