# WithHostPort

- Module: [Aspire.Hosting.PostgreSQL](/reference/api/go/aspire.hosting.postgresql.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`PgWebContainerResource`](/reference/api/go/aspire.hosting.postgresql/pgwebcontainerresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

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

## Definition

```go
func (PgWebContainerResource) WithHostPort(port *float64) PgWebContainerResource
```

## Parameters

- `port` (`*float64`) -- The port to bind on the host. If `null` is used random port will be assigned.

## Returns

[`PgWebContainerResource`](/reference/api/go/aspire.hosting.postgresql/pgwebcontainerresource.md) -- The resource builder for pgweb.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`PgWebContainerResource`](/reference/api/go/aspire.hosting.postgresql/pgwebcontainerresource.md)
