简体   繁体   中英

nodejs application hosted from sub-folder on azure websites

I'm hoping somebody can help me here. I am very new to NodeJS and am trying to deploy a basic sample website created from the Angular seed project to an Azure website via git deploy. The issue i'm having is that I don't understand how to configure the "root" of my application once it is deployed to Azure. My folder structure looks like this:

-app
--js
--css
--index.html
-scripts
--web_server.js

When I run locally, i just cd to my app folder and then start the web_server.js script with node from there.

When it deploys to Azure, it somehow finds the web_server.js file and starts node. But now I have to browse specifically to the app subfolder to view my site. I don't want to do that. Any suggestions?

Look into using a package.json file in the root and pointing it to your site; use main or binaries to point to the subdirectory's JS file.

Azure Web Sites will use that information to find your scripts/web_server.js then, though it might be easier just to root it all at the top, at least to get things rolling.

See also: https://www.npmjs.org/doc/files/package.json.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM