在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:molnarg/node-http2开源软件地址:https://github.com/molnarg/node-http2开源编程语言:JavaScript 100.0%开源软件介绍:node-http2An HTTP/2 (RFC 7540) client and server implementation for node.js. NOTE WELL This package is officially deprecated. As of node 9.0.0, there is an 'http2' package built-in. You should use that one instead. Installation
APIThe API is very similar to the standard node.js HTTPS API. The goal is the perfect API compatibility, with additional HTTP2 related extensions (like server push). Detailed API documentation is primarily maintained in the ExamplesUsing as a servervar options = {
key: fs.readFileSync('./example/localhost.key'),
cert: fs.readFileSync('./example/localhost.crt')
};
require('http2').createServer(options, function(request, response) {
response.end('Hello world!');
}).listen(8080); Using as a clientrequire('http2').get('https://localhost:8080/', function(response) {
response.pipe(process.stdout);
}); Simple static file serverAn simple static file server serving up content from its own directory is available in the $ node ./example/server.js Simple command line clientAn example client is also available. Downloading the server's own source code from the server: $ node ./example/client.js 'https://localhost:8080/server.js' >/tmp/server.js Server pushFor a server push example, see the source code of the example server and client. Status
DevelopmentDevelopment dependenciesThere's a few library you will need to have installed to do anything described in the following
sections. After installing/cloning node-http2, run Used libraries:
For pretty printing logs, you will also need a global install of bunyan ( Developer documentationThe developer documentation is generated from the source code using docco and can be viewed online
here. If you'd like to have an offline copy, just run
Running the testsIt's easy, just run Test coverageTo generate a code coverage report, run
There's a hosted version of the detailed (line-by-line) coverage report here. LoggingLogging is turned off by default. You can turn it on by passing a bunyan logger as When using the example server or client, it's very easy to turn logging on: set the Running the example server and client with $ HTTP2_LOG=info node ./example/server.js $ HTTP2_LOG=info node ./example/client.js 'https://localhost:8080/server.js' >/dev/null ContributorsThe co-maintainer of the project is Nick Hurley. Code contributions are always welcome! People who contributed to node-http2 so far:
Special thanks to Google for financing the development of this module as part of their Summer of Code program (project: HTTP/2 prototype server implementation), and Nick Hurley of Mozilla, my GSoC mentor, who helped with regular code review and technical advices. LicenseThe MIT License Copyright (C) 2013 Gábor Molnár [email protected] |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论