[@bs.val] external envPort: string = “process.env.PORT”

How do I test if envPort is undefined?

Normally I would do const PORT = process.env.PORT || 9000 but that doesn’t work in ReasonML

bucklescript.github.io Bind to Global Values · BuckleScript Do you want to use window? Or Math? Or anything that you don't have to first import or require in JavaScript? This section describes how to access those from BuckleScript.

I know I can also use https://bucklescript.github.io/bucklescript/api/Node.Process.html but the problem is more how one would do it if they had to. And right now if you google it, there is no good results.

https://www.google.com/search?q=process.env.PORT+reasonml

https://www.google.com/search?q=process.env+reasonml

EDIT: An example of how to get a port if defined.