mirror of
https://github.com/oxen-io/oxen-website.git
synced 2023-12-13 21:00:18 +01:00
24 lines
676 B
JavaScript
24 lines
676 B
JavaScript
const { createServer } = require('https');
|
|
const { parse } = require('url');
|
|
const next = require('next');
|
|
const fs = require('graceful-fs');
|
|
|
|
const dev = process.env.NODE_ENV !== 'production';
|
|
const app = next({ dev });
|
|
const handle = app.getRequestHandler();
|
|
|
|
const httpsOptions = dev && {
|
|
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');
|
|
});
|
|
});
|