Friday 14 April 2017

Set nodejs project directory based on the URL

I am currently serving angular1 application over node js app. I want to serve my angular1 app as well as angular2 app from same domain with this node server. I have following setting in my app.js of node js file:

var staticDir = nodeEnv == 'development' ? path.join(__dirname, '/home/sovf/ang1/') : '/data/project/angular/app';

My angular1 project directory is here: /home/sovf/ang1/ My angular2 project directory is here: /home/svof/ang2/

How can I configure the staticDir to use '/home/svof/ang2/' , when the url matches /ang2/*

I have tried enogh to look for resources and node configuration for this but could not find anything. Can any one please help here.



via JK_Jha

No comments:

Post a Comment