Yar
Yar

Reputation: 7457

How to run a node.js app in background on Azure

Say I have this simple nodejs app and want to deploy it to Azure as a web app to run in background:

//server.js
function test() {
    // send some request to a url
}
setInterval(test, 10000);

So I'd do this on Heroku by adding a Procfile and a command like worker: node server.js, but what's the equal method for azure?

Upvotes: 1

Views: 1037

Answers (1)

Admir Tuzović
Admir Tuzović

Reputation: 11177

Background tasks in Microsoft Azure App Service are called WebJobs. You can execute any of the following as a WebJob:

  • .cmd, .bat, .exe (using windows cmd)
  • .ps1 (using powershell)
  • .sh (using bash)
  • .php (using php)
  • .py (using python)
  • .js (using node)
  • .jar (using java)

You can read more about WebJobs on Microsoft Azure official documentation center: Run Background tasks with WebJobs

Also, Scott Allen has nice tutorial on node.js and WebJobs: Azure WebJobs With Node.js

Upvotes: 2

Related Questions