import https from '../index.js' // Helpers function html(message) { return `Hello, world!

${message}

` } const headers = {'Content-Type': 'text/html'} let options = {} // For globally-trusted Let’s Encrypt certificates uncomment options. // To provision certificates, also remove “staging: true” property. // const os = require('os') // options = { // domains: [os.hostname()], // staging: true // } // Create HTTPS server at https://localhost with locally-trusted certificates. const server = https.createServer(options, (request, response) => { // Respond to all routes with the same page. response.writeHead(200, headers) response.end(html('Hello, world!')) }) server.listen(443, () => { console.log(' 🎉 Server running on port 443.') })