Watch Aspire live streamsDocsTry Aspire

withHttpEndpoint

Method
📦 Aspire.Hosting v13.6.5
interface ContainerResource {
// ... omitted for brevity
withHttpEndpoint(
port?: number,
targetPort?: number,
name?: string,
env?: string,
isProxied?: boolean): IResourceWithEndpoints;
}

Signature

methodwithHttpEndpointbuilder
Adds an HTTP endpoint
withHttpEndpoint(
port?: number,
targetPort?: number,
name?: string,
env?: string,
isProxied?: boolean): IResourceWithEndpoints
portnumberoptionalAn optional port. This is the port that will be given to other resource to communicate with this resource.
targetPortnumberoptionalThis is the port the resource is listening on. If the endpoint is used for the container, it is the container port.
namestringoptionalAn optional name of the endpoint. Defaults to "http" if not specified.
envstringoptionalAn optional name of the environment variable to inject.
isProxiedbooleanoptionalSpecifies if the endpoint will be proxied by DCP. Defaults to `null`.
IResourceWithEndpoints

Applies to

This method applies to the following types: