# IYarpConfigurationBuilder

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

Interface to build a configuration file for YARP

## Definition

```typescript
interface IYarpConfigurationBuilder {
  addCatchAllRoute(target: ExternalServiceResource|string): YarpRoute;
  addClusterFromEndpoint(endpoint: EndpointReference): YarpCluster;
  addClusterFromExternalService(externalService: ExternalServiceResource): YarpCluster;
  addClusterFromResource(resource: IResourceWithServiceDiscovery): YarpCluster;
  addClusterWithDestination(
      clusterName: string,
      destination: any): YarpCluster;
  addClusterWithDestinations(
      clusterName: string,
      destinations: any[]): YarpCluster;
  addRoute(
      path: string,
      target: ExternalServiceResource|string): YarpRoute;
}
```

## Methods

- [addCatchAllRoute](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addcatchallroute.md) -- `method` -- Adds a catch-all route for a cluster, endpoint, resource, or string destination target.
    ```typescript
  addCatchAllRoute(target: ExternalServiceResource|string): YarpRoute
  ```
- [addClusterFromEndpoint](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterfromendpoint.md) -- `method` -- Adds a cluster for an endpoint reference.
    ```typescript
  addClusterFromEndpoint(endpoint: EndpointReference): YarpCluster
  ```
- [addClusterFromExternalService](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterfromexternalservice.md) -- `method` -- Adds a cluster for an external service resource.
    ```typescript
  addClusterFromExternalService(externalService: ExternalServiceResource): YarpCluster
  ```
- [addClusterFromResource](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterfromresource.md) -- `method` -- Adds a cluster for a resource that supports service discovery.
    ```typescript
  addClusterFromResource(resource: IResourceWithServiceDiscovery): YarpCluster
  ```
- [addClusterWithDestination](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterwithdestination.md) -- `method` -- Adds a cluster from a single destination.
    ```typescript
  addClusterWithDestination(clusterName: string, destination: any): YarpCluster
  ```
- [addClusterWithDestinations](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterwithdestinations.md) -- `method` -- Adds a cluster from multiple destinations.
    ```typescript
  addClusterWithDestinations(clusterName: string, destinations: any[]): YarpCluster
  ```
- [addRoute](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addroute.md) -- `method` -- Adds a route for a cluster, endpoint, resource, or string destination target.
    ```typescript
  addRoute(path: string, target: ExternalServiceResource|string): YarpRoute
  ```
