Watch Aspire live streamsDocsTry Aspire

withEndpoint

Method
📦 Aspire.Hosting v13.6.0
interface ContainerResource {
// ... omitted for brevity
withEndpoint(
port?: number,
targetPort?: number,
scheme?: string,
name?: string,
env?: string,
isProxied?: boolean,
isExternal?: boolean,
protocol?: ProtocolType): IResourceWithEndpoints;
}

Signature

methodwithEndpointbuilder
Adds a network endpoint
withEndpoint(
port?: number,
targetPort?: number,
scheme?: string,
name?: string,
env?: string,
isProxied?: boolean,
isExternal?: boolean,
protocol?: ProtocolType): 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.
schemestringoptionalAn optional scheme e.g. (http/https). Defaults to the `protocol` argument if it is defined or "tcp" otherwise.
namestringoptionalAn optional name of the endpoint. Defaults to the scheme name if not specified.
envstringoptionalAn optional name of the environment variable that will be used to inject the `targetPort`. If the target port is null one will be dynamically generated and assigned to the environment variable.
isProxiedbooleanoptionalSpecifies if the endpoint will be proxied by DCP. Defaults to `null`.
isExternalbooleanoptionalIndicates that this endpoint should be exposed externally at publish time.
protocolProtocolTypeoptionalNetwork protocol: TCP or UDP are supported today, others possibly in future.
IResourceWithEndpoints

Applies to

This method applies to the following types: