Skip to content

Instantly share code, notes, and snippets.

@limzykenneth
Created July 20, 2020 15:06
Show Gist options
  • Save limzykenneth/0bb0575a7dc3ec825833b11f56ae395c to your computer and use it in GitHub Desktop.
Save limzykenneth/0bb0575a7dc3ec825833b11f56ae395c to your computer and use it in GitHub Desktop.
/**
* Create HTTP server.
*/
let server;
if(process.env.NODE_ENV !== "production"){
const https = require("https");
const httpsOptions = {
key: fs.readFileSync(path.join(__dirname, "../cert/private.key")),
cert: fs.readFileSync(path.join(__dirname, "../cert/public.crt"))
};
server = https.createServer(httpsOptions, app);
}else{
const http = require("http");
server = http.createServer(app);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment