V
V
Vladimir Golub2019-12-10 17:05:46
Node.js
Vladimir Golub, 2019-12-10 17:05:46

How to check if the server is running locally or on a VPS?

Need to check the environment where the server is running?
Will it be enough to check the type HOST !== '0.0.0.0' - so it's not a localhost ?
NODE_ENV cannot be checked, as there may be a local launch in production.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yustas Alexu, 2019-12-10
@RazerVG

NODE_ENV cannot be checked, as there may be a local launch in production.

Create another variable and pass the environment to it when the application starts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question