Create & Deploy a Node API app on Azure

App creation

In this article we will see how to deploy a simple Node API app on Azure and will browse few methods. 
To create the API, you should Have Visual Studio Code and to host the api you would need an active Azure subscription.

1 – Create a folder with name Azure_node_express open that folder in Visual Studio Code.

Now add an app folder inside Azure_node_express with name WebApp.

Now open powershell in terminal using Ctrl+J and browse to location of WebApp using cd command cd WebApp

Now add package.json file run using command : npm init -y

Now install express package using command: npm i express

Now inside WebApp folder add a file called index.js, it will be our main and the startup file.

After doing all these we we’ll have our app with below looking structure.

Creating demo Node API app

Now change the package.json file & index.js file as shown here. 

We have declared a characters_json_data JSON array which we are using as a small data source.

We have a default url (/) and a character URL (/character) where we can pass name of our favorite cartoon character to get its corresponding details.

If we have these files correctly placed we’ll have our basic app ready to run.

Now to run it locally, open terminal using ctrl+J and in terminal browse to location where we have our package.json file.

Then run command : npm start

After doing that we will see below output in terminal 

If you see this it means the app is running now we should test the output in browser. So we can open these two URLs for it : 




Below is the output for character URL, it shows our app is running.

Now to debug the application we can see how to debug Node applications.

Complete project can also be found on this Github source

Deployment on Azure

Below are the steps:

1 – Open extension from the left panel and search “azure”. Then install it if you dont have already. Along with app-service feature it contains many other services also like Azure functions etc.


Then Open Azure tab from the left panel and go the subscription and see the web apps installed inside the App services option.

If you want to deploy your app on an existing App service then its ok but if you want to deploy your app on a new App service then we will have to create a new app service by right-clicking on the App Services menu like below.

Select the subscription and in the box and give a unique name to the app-service like below; then press Enter. We are taking “nodeexpressapp1” as the name.

create app

Then select Node version and pricing tier. We have option to select free pricing also like this:

Once all these steps are complete go to the terminal window, we should be able to see our app-service being created in the terminal window. After few seconds/minutes the app-service will be created.

Select Yes below if you want to deploy new changes on same app service now.

Now to deploy our app on the newly created nodeexpressapp1  app-service as follows:

Now select the name of our app-service which is nodeexpressapp1.

Now once our app is deployed we’ll see the small popup on bottom:

Now click on the browse button or open our app URL directly in a browser.

We will be able to see below:

So we have deployed our app successfully now!

Now to deploy any new change just right click on WebApp folder and select deploy to web app…

More from Node/Javascript:

Natalie Harris
With references from Alan Plang
Kyle Aniston
With references from Alan Plang
Kyle Aniston
With references from StackOverflow
Mike Morgan
With references from StackOverflow
Mike Morgan
Forwared by QwertyBot
Mike Morgan
Forwared by QwertyBot
Kyle Aniston
Forwared by Alan Plang

One thought on “Create & Deploy a Node API app on Azure

Leave a Reply

Your email address will not be published. Required fields are marked *