Effect CommunityEC
Effect Community7mo ago
2 replies
Coda-Cola

Dynamically Assigning and Discovering Ports with NodeHttpServer

Using NodeHttpServer with a dynamic port: I have an app that internally spins up a web server purely to be used for callbacks. I don't care what port it runs on, so long as it's one that's free and I can discover it to pass to the service that makes the call back. I've attempted to use both 0 and undefined in the port parameter to NodeHttpServer.layer, but in both cases I see nothing reported by HttpServer.withLogAddress.

How might I:
- Confirm whether or not the server is running? (if so, this confirms that withLogAddress only works with static port assignments)
- If running, discover the port it's running on?
Was this page helpful?