How to run servers on multiple ports simultaneously? #367
-
I'd love to see an example showing that trillium can handle spawning HTTP servers on two different ports simultaneously, and serve different things to each. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I converted this issue to a discussion because there are a large number of examples that people might want, and they don't necessarily all need to be in the trillium repository. I'll throw together a gist for your request and update this answer. Do you want one handler that responds on two different ports, or two different handlers that are running on different ports within the same binary? |
Beta Was this translation helpful? Give feedback.
This is definitely something trillium supports doing, and in fact as a relatively-unopinionated toolkit, there are a few different ways of doing it. I'll offer the most straightforward way to meet the constraints, but depending on how much you've simplified, it may not be the ideal solution.