Is there a way to check the current project in a custom app? #3115
-
I am currencly developing an application that communicates with an external API from CT. We have 2 APIs one for production and one for staging/development, and the same goes for our Commercetools, meaning 1 project for production and one for development. Is there a way for the custom app to check which one it is currently in so that I can call the correct API? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @XohanOtero, there are a couple of strategies to allow your application to determine the correct environment (production or development) and hence call the correct API.
Let me know if this was helpful. |
Beta Was this translation helpful? Give feedback.
Hey @XohanOtero, there are a couple of strategies to allow your application to determine the correct environment (production or development) and hence call the correct API.
The most common method is to use Environment Variables.
You can set an environment variable that your app can access and check. In a Node.js app, you could do something like:
Let me know if this was helpful.