-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (24 loc) 路 830 Bytes
/
Copy pathserver.js
File metadata and controls
27 lines (24 loc) 路 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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('./certs/key.pem'),
cert: fs.readFileSync('./certs/cert.pem'),
// Allow insecure TLS protocol versions
minVersion: 'TLSv1',
};
app.prepare().then(() => {
createServer(httpsOptions, (req, res) => {
const parsedUrl = parse(req.url, true);
handle(req, res, parsedUrl);
}).listen(9002, (err) => {
if (err) throw err;
console.log('> Ready on https://localhost:9002');
console.log('> Also available on https://holis.test:9002');
console.log('> And on https://<institution>.holis.test:9002');
});
});