Thursday, 21 February 2019

Write an https app in Node and use it on an Azure App Service

I have written a node.js application which I have been hosting on standard Linux server. It works fine, but I want to move it to Azure. I am not sure how to change the following lines:

var options = {
    key:  fs.readFileSync(process.env.CERT_KEY_PATH),
    cert: fs.readFileSync(process.env.CERT_PATH)
};

if (process.env.CERT_BUNDLE) {
  options['ca'] = [
    fs.readFileSync(process.env.CERT_BUNDLE_ONE),
    fs.readFileSync(process.env.CERT_BUNDLE_TWO),
    fs.readFileSync(process.env.CERT_BUNDLE_THREE)
  ]
}

var server = https.createServer(options, app);

I have read this guide which tells me that instead of my certificated being read from a file the file system that I upload them in the portal.

Then in my node app do I just write var server = http.createServer(...) ? And have Azure take care of the https part?



from Write an https app in Node and use it on an Azure App Service

No comments:

Post a Comment