[**@wocart/storefront v3.1.0**](../../README)

***

[@wocart/storefront](../../README) / [astro](../README) / createProxyEndpoint

# Function: createProxyEndpoint()

> **createProxyEndpoint**\<`TInput`, `TOutput`\>(`config`): [`AstroAPIRoute`](../type-aliases/AstroAPIRoute)

Create a proxy endpoint handler

## Type Parameters

### TInput

`TInput`

### TOutput

`TOutput`

## Parameters

### config

[`ProxyEndpointConfig`](../interfaces/ProxyEndpointConfig)\<`TInput`, `TOutput`\>

## Returns

[`AstroAPIRoute`](../type-aliases/AstroAPIRoute)

## Example

```ts
// POST endpoint with validation
export const POST = createProxyEndpoint({
  method: 'POST',
  client: validateCart,
  inputSchema: cartSchema,
  csrfProtection: true,
});

// GET endpoint with path params
export const GET = createProxyEndpoint({
  method: 'GET',
  client: fetchCommunes,
  pathParams: { wilayaId: 'number' },
});
```
