# NatsServerResource

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

A resource that represents a NATS server container.

## Definition

```typescript
interface NatsServerResource
  extends IComputeResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly host: EndpointReferenceExpression;
  passwordParameter: ParameterResource;
  readonly port: EndpointReferenceExpression;
  readonly primaryEndpoint: EndpointReference;
  readonly uriExpression: ReferenceExpression;
  userNameParameter: ParameterResource;
  readonly userNameReference: ReferenceExpression;
  withDataBindMount(
      source: string,
      isReadOnly?: boolean): NatsServerResource;
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): NatsServerResource;
  withJetStream(): NatsServerResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the NATS server.
- `host`: `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- `passwordParameter`: `ParameterResource` `get - set` -- Gets or sets the password for the NATS server.
- `port`: `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the NATS server.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the connection URI expression for the NATS server.
- `userNameParameter`: `ParameterResource` `get - set` -- Gets or sets the user name for the NATS server.
- `userNameReference`: `ReferenceExpression` `get` -- Gets a reference to the user name for the NATS server.

## Methods

- [withDataBindMount](/reference/api/typescript/aspire.hosting.nats/natsserverresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a NATS container resource.
    ```typescript
  withDataBindMount(source: string, isReadOnly?: boolean): NatsServerResource
  ```
- [withDataVolume](/reference/api/typescript/aspire.hosting.nats/natsserverresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a NATS container resource.
    ```typescript
  withDataVolume(name?: string, isReadOnly?: boolean): NatsServerResource
  ```
- [withJetStream](/reference/api/typescript/aspire.hosting.nats/natsserverresource/withjetstream.md) -- `method` -- Adds JetStream support to the NATS server resource.
    ```typescript
  withJetStream(): NatsServerResource
  ```
