How to run node.js in azure webjobs?

情到浓时终转凉″ 提交于 2019-12-04 18:21:56

If you have a file with a .js extension it'll be run as a node program

Full documentation on Azure Web Jobs here: https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/

It's relatively easy if you know some undocumented details :)

The key concept is ensuring correct application structure (for Azure). Your main application script should be named run.js, so in other words, your app should be able to start properly by executing node run.js command.

What is more don't count on your package.json dependencies. From my own experience, I can tell that package.json dependencies sometimes work and sometimes not, so it is much safer to upload the node_modules/ manually.

You may add multiple app files by Zipping them and uploading inside Azure App > WebJob panel.

If your app has no bugs it should be running a few seconds after the upload.

For more info checkout this blog post.

Like the previous answers state, it's really as easy as adding .js files to your web job and following the instructions. The only thing that's particular about the process is that if you require any 3rd party modules in your Node script, then you have to zip up the .js files and the node_modules folder and deploy the whole thing - node_modules folder and all.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!