File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -99,12 +99,18 @@ import { schema } from './previous-step';
99
99
const handler = createHandler ({ schema });
100
100
101
101
// Create an HTTP/2 server using the handler on `/graphql/stream`
102
- const server = http2 .createServer ((req , res ) => {
103
- if (req .url .startsWith (' /graphql/stream' )) {
104
- return handler (req, res);
105
- }
106
- res .writeHead (404 ).end ();
107
- });
102
+ const server = http2 .createSecureServer (
103
+ {
104
+ key: fs .readFileSync (' localhost-privkey.pem' ),
105
+ cert: fs .readFileSync (' localhost-cert.pem' ),
106
+ },
107
+ (req , res ) => {
108
+ if (req .url .startsWith (' /graphql/stream' )) {
109
+ return handler (req, res);
110
+ }
111
+ return res .writeHead (404 ).end ();
112
+ },
113
+ );
108
114
109
115
server .listen (4000 );
110
116
console .log (' Listening to port 4000' );
You can’t perform that action at this time.
0 commit comments