.WithHttpEndpoint for ResourceWithEndpoints #269
tommasodotNET
started this conversation in
General
Replies: 1 comment 6 replies
-
cc. @aaronpowell |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have NodeJS and Golang resources which are of type
IResourceWithEndpoints
. This kind of resource lets the dev reference directly the resource without the need to get an endpoint. This works assuming the referencing resource can handle a multi protocol url (http/https).NodeJs declares the
.WithHttpEndpoint()
method inside theAddViteApp
, while Golang lets the user declare the use of an Http or Https endpoint in the AppHost.I think the Golang way of handling this should also be adopted by Vite, since we cannot take for granted that a certain project can run with http locally or that the environment variable it uses for the port is actually
PORT
.In this case, for instance, I had to handle the fact that the Vite app can use a https endpoint when running locally but not in deployment, since it was conflicting with the already existing http one which is marked as external inside the
AddViteApp()
. Moreover, I could not use the standardVITE_PORT
env var for the port because the http port was declared inside theAddViteApp()
method and cannot be overwritten.Anyway, I think the behaviour of Golang and NodeJs should be standard in this case, so I'd like to open a discussion before creating an issue in a direction or the other.
Beta Was this translation helpful? Give feedback.
All reactions