Listen additional port Microsoft Azure Nodejs

If you’re deploying to an Azure Web App, only ports 80 and 443 are public-facing. This maps to a specific port for your app to listen to, retrievable via process.env.PORT. And if you’re running both in Azure and locally, you can easily manage which port you listen to, with something like this, based on your reference to port 1337 in your question:

var port = process.env.PORT || 1337;

If you needed to listen in on multiple ports, or ones different from 80/443, you’d need to deploy to a VM or a Cloud Service (web/worker role). Or deploy multiple web apps.

Leave a Comment