# YarpResource.withHostPort

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

Configures the host port that the YARP resource is exposed on instead of using randomly assigned port.

## Definition

```typescript
interface YarpResource {
  // ... omitted for brevity
  withHostPort(port: number): YarpResource;
}
```

## Signature

```typescript
withHostPort(port: number): YarpResource
```

## Parameters

- `port` (`number`)

## Returns

[YarpResource](/reference/api/typescript/aspire.hosting.yarp/yarpresource.md) `builder`

## Defined on

- [YarpResource](/reference/api/typescript/aspire.hosting.yarp/yarpresource.md) -- `handle`
