Created
June 9, 2019 10:53
-
-
Save zprima/1361148536cef3cf3d80649c42aeffbd to your computer and use it in GitHub Desktop.
medium_p10_c1
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
const { createServer } = require('https'); | |
const { parse } = require('url'); | |
const next = require('next'); | |
const fs = require('fs'); | |
const dev = process.env.NODE_ENV !== 'production'; | |
const app = next({ dev }); | |
const handle = app.getRequestHandler(); | |
const httpsOptions = { | |
key: fs.readFileSync('./certificates/localhost.key'), | |
cert: fs.readFileSync('./certificates/localhost.crt') | |
}; | |
app.prepare().then(() => { | |
createServer(httpsOptions, (req, res) => { | |
const parsedUrl = parse(req.url, true); | |
handle(req, res, parsedUrl); | |
}).listen(3000, err => { | |
if (err) throw err; | |
console.log('> Ready on https://localhost:3000'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment