# YarpConfigurationBuilder.AddRoute

- Module: [Aspire.Hosting.Yarp](/reference/api/go/aspire.hosting.yarp.md)
- Defined on: [YarpConfigurationBuilder](/reference/api/go/aspire.hosting.yarp/yarpconfigurationbuilder.md)
- Version: `17.0.0`
- Kind: `method`

Adds a route for a cluster, endpoint, resource, or string destination target.

## Definition

```go
type YarpConfigurationBuilder interface {
    // ... omitted for brevity
    AddRoute(
        path string,
        target any,
    ) YarpRoute
}
```

## Signature

```go
AddRoute(
    path string,
    target any,
) YarpRoute
```

## Parameters

- `path` (`string`) -- The path to match for this route.
- `target` (`any`) -- The target cluster, endpoint, resource, or string destination for this route.

## Returns

[`YarpRoute`](/reference/api/go/aspire.hosting.yarp/yarproute.md) -- The created route.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [YarpConfigurationBuilder](/reference/api/go/aspire.hosting.yarp/yarpconfigurationbuilder.md) -- `interface`
