Mark Mark - 3 months ago 33x
Node.js Question

cannot start nodejs web api hosted in Azure


and started to created my own restful API using restify.

I have created a very simple
file which contains basically a hello world type example starting up like:'/api/messages', servicemanager.verifyFramework(), servicemanager.listen());

server.get(/.*/, restify.serveStatic({
'directory': '.',
'default': 'index.html'

server.listen(process.env.port || 3978, function () {
console.log('%s listening to %s',, server.url);

which works fine locally. I cant hit http://localhost:3978 and I can test my API calls just fine calling http://localhost:3978/api/messages.

I have deployed my code into bitbucket and now I want to host these APIs in Azure using
App Services

My project structure is like so:


When I setup the new app service in Azure, I can see that the deployment receives the code from BB, but the service never responds to my requests.

I have setup the home path of the app to live in:
and I can see the
when I navigate to so thats good.

I actually get a 404 error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

There are heaps of examples of how to setup continuous deployment using bitbucket and for the most part, they all seem to work, but my
file doesnt seem to be the getting called or starting up.

How can I debug whats going on here?

Is the
file used in this scenario by Azure?



As the root directory path of the application hosted on Azure App Services, is D:\home\site\wwwroot. And about the nodejs application, the Azure fabric will find the entrance script in root directory like server.js. And the requests are handled via web.config in root directory. If there is missing server.js or web,config file, you will occur 404 error.

You can try to modify or your application's structure, like to:


Then, you deploy your application to Azure via GIT or from BB, the Azure deployment task will run command npm install and generate the web.config wile in the root directory.

Any further concern, please feel free to let me know.