-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support http2 #66
base: master
Are you sure you want to change the base?
Support http2 #66
Conversation
只有在 https:true 的时候才会是 http2.createSecureServer,默认 http2:true 用的是 http2.createServer;
这个跟 http 一样的道理,我们建议用户使用 http,由代理来处理 https, 但还是支持用户直接使用 https
…On 2018年4月25日 +0800 AM6:50, Guan Ce ***@***.***>, wrote:
根据 https://blog.risingstack.com/node-js-10-lts-feature-breakdown/ 的建议
Most of the examples you’ll find will tell you that you should use http2.createSecureServer but as we discussed above, you should let your edge proxy handle that.
···
const http2 = require('http2');
const koa = require('koa');
const router = require('koa-route');
const fs = require('fs');
const app = koa();
app.use(router.get('/', function *(next) {
this.body = 'Hello, World!';
yield next;
}));
http2
.createServer({}, app.callback())
.listen(3000, (err) => {
if (err) {
throw new Error(err);
}
console.log('Listening on port: 3000.');
});
···
注意用的是 http2.createServer 而不是 http2.createSecureServer
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I found that the ts unit test failed in ci. Is this PR affecting the ts? @atian25 |
server = require('https').createServer(httpsOptions, app.callback()); | ||
} | ||
|
||
if (options.http2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need testcase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will add test cases later. This may be a bit complicated as supertest
does not support http2.
Out of curiosity, does egg now support http2 (without nginx) or not? koa was perfectly able to run on http2. CCing @dead-horse @leaves4j |
Checklist
npm test
passesAffected core subsystem(s)
Description of change