Created
March 1, 2017 22:13
-
-
Save benedyktdryl/bff689ead4d557f0e119e976d2ce35cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const fs = require('fs') | |
const Hapi = require('hapi') | |
const Http2 = require('http2') | |
const server = new Hapi.Server() | |
let listener = Http2.createServer({ | |
key: fs.readFileSync('./key.pem'), | |
cert: fs.readFileSync('./cert.pem') | |
}) | |
if (!listener.address) { | |
listener.address = function() { | |
return this._server.address() | |
} | |
} | |
server.connection({ | |
listener: listener, | |
port: '8000', | |
tls: true | |
}) | |
server.route({ | |
method: 'GET', | |
path: '/', | |
handler: (request, reply) => reply('hello world') | |
}) | |
server.start(err => { | |
if (err) console.error(err) | |
console.log(`Started ${server.connections.length} connections`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment