- 服务器 Server
- server([options])
- Server options
- 服务器属性 Server properties
- server.auth.default(options)
- server.auth.scheme(name, scheme)
- server.auth.strategy(name, scheme, [options])
- await server.auth.test(strategy, request)
- await server.auth.verify(request)
- server.bind(context)
- server.cache(options)
- await server.cache.provision(options)
- server.control(server)
- server.decoder(encoding, decoder)
- server.decorate(type, property, method, [options])
- server.dependency(dependencies, [after])
- server.encoder(encoding, encoder)
- server.event(events)
- await server.events.emit(criteria, data)
- server.events.on(criteria, listener)
- server.events.once(criteria, listener)
- await server.events.once(criteria)
- server.expose(key, value)
- server.expose(obj)
- server.ext(events)
- server.ext(event, method, [options])
- await server.initialize()
- await server.inject(options)
- server.log(tags, [data, [timestamp]])
- server.lookup(id)
- server.match(method, path, [host])
- server.method(name, method, [options])
- server.method(methods)
- server.path(relativeTo)
- await server.register(plugins, [options])
- server.route(route)
- server.rules(processor, [options])
- await server.start()
- server.state(name, [options])
- server.states.add(name, [options])
- await server.states.format(cookies)
- await server.states.parse(header)
- await server.stop([options])
- server.table([host])
- Route options
- route.options.app
- route.options.auth
- route.options.bind
- route.options.cache
- route.options.compression
- route.options.cors
- route.options.description
- route.options.ext
- route.options.files
- route.options.handler
- route.options.id
- route.options.isInternal
- route.options.json
- route.options.jsonp
- route.options.log
- route.options.notes
- route.options.payload
- route.options.plugins
- route.options.pre
- route.options.response
- route.options.rules
- route.options.security
- route.options.state
- route.options.tags
- route.options.timeout
- route.options.validate
- Request lifecycle
- 请求
- 插件
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
server.decoder(encoding, decoder)
注册一个自定义内容解码压缩器,以扩展对 'gzip'
和 ' deflate
' 的内置支持,其中:
encoding
- 解码器名称字符串。decoder
- 使用签名function(options)
的函数,其中options
是路由payload.compression
配置选项中配置的编码特定选项, 返回值是与节点输出兼容的对象zlib.createGunzip()
.
返回值: none.
const Zlib = require('zlib'); const Hapi = require('hapi'); const server = Hapi.server({ port: 80, routes: { payload: { compression: { special: { chunkSize: 16 * 1024 } } } } }); server.decoder('special', (options) => Zlib.createGunzip(options));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论