# withHttpEndpoint

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Version: `13.2.0`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire)

Adds an HTTP endpoint

## Definition

```typescript
interface ContainerResource {
  // ... omitted for brevity
  withHttpEndpoint(
    port?: number,
    targetPort?: number,
    name?: string,
    env?: string,
    isProxied?: boolean): IResourceWithEndpoints
}
```

## Parameters

- `port` (`number`) `optional`
- `targetPort` (`number`) `optional`
- `name` (`string`) `optional`
- `env` (`string`) `optional`
- `isProxied` (`boolean`) `optional` `= True`

## Returns

[IResourceWithEndpoints](/reference/api/typescript/aspire.hosting/iresourcewithendpoints.md) `builder`

## Applies to

- [ContainerResource](/reference/api/typescript/aspire.hosting/containerresource.md)
- [ExecutableResource](/reference/api/typescript/aspire.hosting/executableresource.md)
- [ProjectResource](/reference/api/typescript/aspire.hosting/projectresource.md)
- [DotnetToolResource](/reference/api/typescript/aspire.hosting/dotnettoolresource.md)
- [CSharpAppResource](/reference/api/typescript/aspire.hosting/csharpappresource.md)
