Skip to content

Instantly share code, notes, and snippets.

@rglover
Created October 3, 2024 20:42
Show Gist options
  • Save rglover/069bdaea91c629e95957610b484ed82c to your computer and use it in GitHub Desktop.
Save rglover/069bdaea91c629e95957610b484ed82c to your computer and use it in GitHub Desktop.
Parrot Example
const express = require('express');
const http2 = require('http2');
const fs = require('fs');
const app = express();
app.get('/', (req, res) => {
res.send('Hello, HTTP/2 World!');
});
const options = {
key: fs.readFileSync('path/to/private-key.pem'),
cert: fs.readFileSync('path/to/certificate.pem')
};
const server = http2.createSecureServer(options, app);
const port = 3000;
server.listen(port, () => {
console.log(`HTTP/2 server running on https://localhost:${port}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment