# withHostPort

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

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

## Definition

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

## Parameters

- `port` (`number`)

## Returns

[MongoExpressContainerResource](/reference/api/typescript/aspire.hosting.mongodb/mongoexpresscontainerresource.md) `builder`

## Applies to

- [MongoExpressContainerResource](/reference/api/typescript/aspire.hosting.mongodb/mongoexpresscontainerresource.md)
