Install Node.js on a local device with recommended systems configuration and run Node.js app using Visual Studio Code by the following commands.
npm install
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-96.png)
npm run
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-97.png)
node filename.js
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-98.png)
After running the node.js services, create a Azure app service for Node.js in azure portal.
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-102-1024x519.png)
.
Now lets create repository in Azure Devops and add a branch called develop and push all the application to that branch.
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-101-1024x382.png)
Add a file and and past the below code and save it with an extension .yml and click on commit.
[powershell]
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- main
- develop
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.x'
displayName: 'Install Node.js'
- script: |
cd ./backend
npm install
# npm run build
displayName: 'npm install and build'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/backend'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
[/powershell]
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-103-1024x735.png)
Now lets start creating a Pipeline for the Node.js application.
Click on Pipelines and click on new pipeline. Select the current repository and add the existing YAML file and
run the pipeline.
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-104-1024x645.png)
Once pipeline creation is successful, lets create a release pipeline.
Create a release pipeline using the information’s from the Azure app service that you have created early and deploy the release pipeline.
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-105-1024x492.png)
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-106-1024x517.png)
![](https://www.azure365pro.com/wp-content/uploads/2023/06/image-107-1024x548.png)
The release pipeline that deploys the code tp the Azure app service.
![](https://www.azure365pro.com/wp-content/uploads/2023/07/image-1024x379.png)
The output for the code that is deployed to the Azure app service
![](https://www.azure365pro.com/wp-content/uploads/2023/07/image-1.png)