I am writing an app and in a function I’d like to know what is the current host. If I have the request object I’ve been able to do:
req.headers.host
that returns something like localhost:3000
I am trying to get the same thing, so find out the current host, when I’m in a module that has no request object. How can I know the host with no req object?
You need to pass the request object somehow. There is no other way.