Creating and Deploying Express Web App on Azure in few steps

In this post we will see how can we setup an express web application and how to deploy an node.js based express web application.

Step 1: Creating an web application in express.

To create a express application skeleton we need to install express generator from npm:

m1

Check available option while creating an express app:

m2

After installing the express generator, we will create an express sample application:

m3

Now go to the application folder and install dependencies:

m4

On Mac OS or Linux, run the app with this command

m5

On Windows, use this command:

m6

The generated app has the following directory structure:

m7

Then load http://localhost:3000/ in your browser to access the app.

Screenshot (46)
app running on localhost

 

OK, now our express app is created and running on localhost.

Step 2: Let us setup our Web App Server in Azure:

Sign in to your Azure portal.

Go to web app service as below:

az1

Create a web app and define the App service Plan

az2

Choose a pricing tier. (For demo purpose you can choose a Free tier)

az3

After choosing and filling all the options click on create. You web app will take about 2-3 mins in creation.

After it is created, open it and choose deployment options in the menu

az4

choose Local Git Repository to fetch our local web app we just created:

az5

For the first time it will ask you about the credentials setup. please define the git credentials.(Give a username and password)

This will create a git clone url for your application. Go to overview section in the menu and copy the git clone URL.

Now let us come back to our express app.

Make sure you have git installed in the local system.

Go to your web app folder and open git bash console follow the below commands to deploy you app on Azure

  • initialize your app folder

git1

  • Connect to remote git URL you create above

git2

  • Add all the files to Queue

git3

  • Start the first commit

git4

  • Push the master files

git5

You will see the logs obviously that deployment is successful.

After this go to your Azure app URL like this -> youapp.azurewebsites.net and you will see that your app is up and running.

Hope it helps!

For any queries contact me here.

Check the official docs for more detailed insights: 

Create node.js app on Azure

Express Generator

Download Git

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s