Node.js 服务端框架,Hapi.js 12.0.0 发布
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.qsconfiguration option. -
Removes the route
payload.qsconfiguration option. -
Removes the
parserOptionsargument from therequest.setUrl()method. -
Authentication scope strings cannot begin with
!or+as those prefix characters now have a special meaning. -
request.route(the route public interface)settings.authchanged to movescopeandentityinside a newaccessarray. -
When using
server.inject(), any HTTP trailers are no longer included inres.headersbut instead are provided underres.trailersto be consistent with node. -
Removed
request.sessionandrequest.auth.sessionplaceholders (was set tonullbefore).
新特性:
-
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
pendingGenerateTimeoutcache option for reducing calls to the generate method while another is already pending. -
Return a
Promisewhen acallbackis not provided. -
Expose CORS origin match status in
request.info.cors.isOriginMatch. -
Expose entire
request.authobject in validation context.
详细改进内容请看发行说明。