# PostgresServerResource.withHostPort

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

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

## Definition

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

## Signature

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

## Parameters

- `port` (`number`)

## Returns

[PostgresServerResource](/reference/api/typescript/aspire.hosting.postgresql/postgresserverresource.md) `builder`

## Defined on

- [PostgresServerResource](/reference/api/typescript/aspire.hosting.postgresql/postgresserverresource.md) -- `handle`
