# IYarpConfigurationBuilder

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

## Definition

```typescript
interface IYarpConfigurationBuilder {
  addCatchAllRoute(cluster: YarpCluster): YarpRoute;
  addCatchAllRouteFromEndpoint(endpoint: EndpointReference): YarpRoute;
  addCatchAllRouteFromExternalService(externalService: ExternalServiceResource): YarpRoute;
  addCatchAllRouteFromResource(resource: IResourceWithServiceDiscovery): 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,
      cluster: YarpCluster): YarpRoute;
  addRouteFromEndpoint(
      path: string,
      endpoint: EndpointReference): YarpRoute;
  addRouteFromExternalService(
      path: string,
      externalService: ExternalServiceResource): YarpRoute;
  addRouteFromResource(
      path: string,
      resource: IResourceWithServiceDiscovery): YarpRoute;
}
```

## Methods

- [addCatchAllRoute](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addcatchallroute.md) -- `method` -- Adds a YARP catch-all route for an existing cluster.
    ```typescript
  addCatchAllRoute(cluster: YarpCluster): YarpRoute
  ```
- [addCatchAllRouteFromEndpoint](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addcatchallroutefromendpoint.md) -- `method` -- Adds a YARP catch-all route for an endpoint reference.
    ```typescript
  addCatchAllRouteFromEndpoint(endpoint: EndpointReference): YarpRoute
  ```
- [addCatchAllRouteFromExternalService](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addcatchallroutefromexternalservice.md) -- `method` -- Adds a YARP catch-all route for an external service resource.
    ```typescript
  addCatchAllRouteFromExternalService(externalService: ExternalServiceResource): YarpRoute
  ```
- [addCatchAllRouteFromResource](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addcatchallroutefromresource.md) -- `method` -- Adds a YARP catch-all route for a resource that supports service discovery.
    ```typescript
  addCatchAllRouteFromResource(resource: IResourceWithServiceDiscovery): YarpRoute
  ```
- [addClusterFromEndpoint](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterfromendpoint.md) -- `method` -- Adds a YARP cluster for an endpoint reference.
    ```typescript
  addClusterFromEndpoint(endpoint: EndpointReference): YarpCluster
  ```
- [addClusterFromExternalService](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterfromexternalservice.md) -- `method` -- Adds a YARP cluster for an external service resource.
    ```typescript
  addClusterFromExternalService(externalService: ExternalServiceResource): YarpCluster
  ```
- [addClusterFromResource](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterfromresource.md) -- `method` -- Adds a YARP 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 YARP cluster with a single destination.
    ```typescript
  addClusterWithDestination(clusterName: string, destination: any): YarpCluster
  ```
- [addClusterWithDestinations](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addclusterwithdestinations.md) -- `method` -- Adds a YARP cluster with multiple destinations.
    ```typescript
  addClusterWithDestinations(clusterName: string, destinations: any[]): YarpCluster
  ```
- [addRoute](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addroute.md) -- `method` -- Invokes the AddRoute method
    ```typescript
  addRoute(path: string, cluster: YarpCluster): YarpRoute
  ```
- [addRouteFromEndpoint](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addroutefromendpoint.md) -- `method` -- Adds a YARP route for an endpoint reference.
    ```typescript
  addRouteFromEndpoint(path: string, endpoint: EndpointReference): YarpRoute
  ```
- [addRouteFromExternalService](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addroutefromexternalservice.md) -- `method` -- Adds a YARP route for an external service resource.
    ```typescript
  addRouteFromExternalService(path: string, externalService: ExternalServiceResource): YarpRoute
  ```
- [addRouteFromResource](/reference/api/typescript/aspire.hosting.yarp/iyarpconfigurationbuilder/addroutefromresource.md) -- `method` -- Adds a YARP route for a resource that supports service discovery.
    ```typescript
  addRouteFromResource(path: string, resource: IResourceWithServiceDiscovery): YarpRoute
  ```
