diff --git a/website/src/pages/get-started.mdx b/website/src/pages/get-started.mdx index 06b2162..a4e559a 100644 --- a/website/src/pages/get-started.mdx +++ b/website/src/pages/get-started.mdx @@ -98,13 +98,17 @@ import { schema } from './previous-step'; // Create the GraphQL over SSE handler const handler = createHandler({ schema }); -// Create an HTTP/2 server using the handler on `/graphql/stream` -const server = http2.createServer((req, res) => { - if (req.url.startsWith('/graphql/stream')) { - return handler(req, res); +// Create a HTTP/2 server using the handler on `/graphql/stream` +const server = http2.createSecureServer( + { + key: fs.readFileSync('localhost-privkey.pem'), + cert: fs.readFileSync('localhost-cert.pem') + }, + (req, res) => { + if (req.url.startsWith('/graphql/stream')) return handler(req, res) + return res.writeHead(404).end() } - res.writeHead(404).end(); -}); +); server.listen(4000); console.log('Listening to port 4000');