# IResourceWithEndpoints.withEndpointCallback

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Defined on: [IResourceWithEndpoints](/reference/api/typescript/aspire.hosting/iresourcewithendpoints.md)
- Version: `13.4.0`
- Kind: `method`

Updates a named endpoint via callback

## Definition

```typescript
interface IResourceWithEndpoints {
  // ... omitted for brevity
  withEndpointCallback(endpointName: string, callback: (obj: EndpointUpdateContext) => Promise<void>, createIfNotExists?: boolean): IResourceWithEndpoints;
}
```

## Signature

```typescript
withEndpointCallback(endpointName: string, callback: (obj: EndpointUpdateContext) => Promise<void>, createIfNotExists?: boolean): IResourceWithEndpoints
```

## Parameters

- `endpointName` (`string`)
- `callback` (`(obj: EndpointUpdateContext) => Promise<void>`)
- `createIfNotExists` (`boolean`) `optional` `= True`

## Returns

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

## Defined on

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