Skip to content

Instantly share code, notes, and snippets.

@makersm
Last active January 26, 2018 05:19
Show Gist options
  • Save makersm/94593eacc61fabff2aca6adb2c622a7e to your computer and use it in GitHub Desktop.
Save makersm/94593eacc61fabff2aca6adb2c622a7e to your computer and use it in GitHub Desktop.
https server
const https = require('https');
const app = require('express')();
const privatekey = fs.readFileSync('PRIV_FILE_PATH');
const certificate = fs.readFileSync('CERT_FILE_PATH');
const credentials = {key: privatekey, cert: certificate};
const port = PORT_NUM;
https.createServer(credentials, app).listen(port, () => {
console.log(`http server start with ${port}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment