Detect URL at node js start

73 views Asked by At

I am using Node JS with Express and app is being hosted on Modulus.io.

I want to deploy the exact same code to 2 different modulus projects.

Is there anyway I can detect either by the URL of the site or any env variables to distinguish between the 2 versions when the app is starting?

I want to do this before any get/post requests are made to the server.

Thanks.

1

There are 1 answers

0
Danhol86 On BEST ANSWER

Modulus has a number of properties which can be accessed under process.env

The property I used was process.env.PROJECT_ID which gives the ID of the modulus project.

There is also PROJECT_URL which gives full path to homepage.