How to run node.js in azure webjobs?

偶尔善良 提交于 2019-12-06 14:00:51

问题


I am having several node js script files.I have to run these js files in azure web jobs.can any one tell me the detail step for how to add the node.js files in azure web jobs and also how to run these web jobs.


回答1:


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/




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/32217907/how-to-run-node-js-in-azure-webjobs

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