How do I get express service port information in the backend service or node environment? #8200
-
I now implement the configure method by inheriting the BackendApplicationContribution module and register a service through the express method. The service needs to return port information to the interface requester. In the front end of the IDE, the service address can be obtained through the method of Endpoint class, but the corresponding implementation is not found in the back end. Is there any better way to achieve it except passing the front end to the back end? In addition, why the specific implementation of the HTTP service is in the Askpass class of the @theia/git module feels a bit strange. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You should implement Obviously it does not necessary the same port as on frontend, if you deploy behind proxy or something. In such case you are better to implement the frontend contribution and make use of |
Beta Was this translation helpful? Give feedback.
You should implement
BackendApplicationContirbution.onStart
lifecycle callbacks. As an argument you will receive an instance of server on which you can callserver.address().port
.Obviously it does not necessary the same port as on frontend, if you deploy behind proxy or something. In such case you are better to implement the frontend contribution and make use of
Endpoint
.