# MongoExpressContainerResource.withHostPort

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

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;
}
```

## Signature

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

## Parameters

- `port` (`number`)

## Returns

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

## Defined on

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