Deploy Nodejs with React to Linux App Service

%3CLINGO-SUB%20id%3D%22lingo-sub-2095053%22%20slang%3D%22en-US%22%3EDeploy%20Nodejs%20with%20React%20to%20Linux%20App%20Service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2095053%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%2C%3C%2FP%3E%3CP%3EI'm%20trying%20to%20deploy%20a%20very%20basic%20Node%20JS%20app%20which%20uses%20a%20front-end%20built%20on%20React%20to%20a%20Linux%20App%20Service.%20I'm%20using%20Azure%20Pipelines%20to%20create%20a%20build%20artifact%20named%20%22deploy%22%20which%20has%20the%20following%20structure%3A%3C%2FP%3E%3CP%3E-deploy%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20-build%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20-public%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20-api%3C%2FP%3E%3CP%3EI%20added%20an%20Environment%20Variable%20named%20%22WEBSITE_NODE_DEFAULT_VERSION%22%20to%20set%20the%20correct%20Node%20version%20to%20use%2C%20but%20I'm%20not%20sure%20if%20I%20need%20any%20%22SCM*%22%20vars.%3C%2FP%3E%3CP%3EI%20created%20a%20release%20pipeline%20which%20uses%20the%20Azure%20App%20Service%20Deploy%20task%20to%20push%20the%20build%20artifact%20out%20to%20the%20App%20Service%2C%20configured%20as%20shown%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screen%20Shot%202021-01-25%20at%2010.34.42%20AM.png%22%20style%3D%22width%3A%20307px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249208iDF6BA42DA22985A0%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screen%20Shot%202021-01-25%20at%2010.34.42%20AM.png%22%20alt%3D%22Screen%20Shot%202021-01-25%20at%2010.34.42%20AM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20was%20hoping%20the%20Startup%20Command%20value%20of%20%22node%20api%2Findex.js%22%20would%20start%20the%20server%20correctly%2C%20but%20I'm%20still%20getting%20the%20default%20landing%20page%20telling%20me%20to%20upload%20some%20code.%20What's%20the%20best%20way%20to%20host%20a%20Node%20JS%20app%20service%20with%20a%20nested%20directory%20structure%3F%20Or%20should%20I%20move%20my%20Express%20app%20to%20the%20root%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2095053%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWeb%20Apps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

Hi there,

I'm trying to deploy a very basic Node JS app which uses a front-end built on React to a Linux App Service. I'm using Azure Pipelines to create a build artifact named "deploy" which has the following structure:

-deploy

    -build

    -public

    -api

I added an Environment Variable named "WEBSITE_NODE_DEFAULT_VERSION" to set the correct Node version to use, but I'm not sure if I need any "SCM*" vars.

I created a release pipeline which uses the Azure App Service Deploy task to push the build artifact out to the App Service, configured as shown:

Screen Shot 2021-01-25 at 10.34.42 AM.png

I was hoping the Startup Command value of "node api/index.js" would start the server correctly, but I'm still getting the default landing page telling me to upload some code. What's the best way to host a Node JS app service with a nested directory structure? Or should I move my Express app to the root? 

 

0 Replies