const sniOptions = (servername, cb) => {
if (servername === 'example.com') {
cb(null, { key: fs.readFileSync('example_key.pem'), cert: fs.readFileSync('example_cert.pem') });
} else {
cb(new Error('No matching certificate'));
}
};
https.createServer({ SNICallback: sniOptions }, app).listen(443);