Diskdrive
Diskdrive

Reputation: 18825

How do I get my Azure websites to run "node server.js"

I'm new to Azure and NodeJS so I apologise in advance if this question is confusing. I'm still trying to understand the basics. Right now, I have a node.JS website that I'm just trying to deploy onto Azure as a webiste.

I have the website deployed using WebMatrix, however, I have a expressJS server side where requires me to actually execute the code "node server.js". On my local machine, I just execute this in command prompt and my server boots up.

However, I'm not sure where I'm supposed to run this on azure?

Is it possible to do this using Azure's website service or do I need to create another azure service type like maybe a cloud service or VM?

Upvotes: 0

Views: 366

Answers (1)

Christos Papoulas
Christos Papoulas

Reputation: 2568

You can either use a VM or you can use a web service for node.js. The first is cheaper. So if you go with this option you have to create a new virtual machine. Let's say a Ubuntu LTS. follow this tutorial for how to upload a vm. Now, you have to login in the VM using a ssh program as putty. Copy your code to a folder or use a program for secure copy as winSCP to do that. In order to deploy node.js at ubuntu follow this commands:

sudo apt-get install python-software-properties python g++ make

sudo add-apt-repository ppa:chris-lea/node.js

sudo apt-get install nodejs

sudo apt-get install npm -y

and then you are able to execute

node server.js

Remember to open the port that node.js working to make visable to outside world.

if you insist to use an azure service you find useful this link.

Upvotes: 1

Related Questions