# POST



# Overview

Exports a ready-to-use `POST` handler for Next.js route handlers. The handler uses the Next.js [createChat](/docs/api-reference/next/create-chat) wrapper and the configuration produced by [withPeam](/docs/api-reference/next/with-peam).

## Source

```ts
import { createChat } from './createChat';

export const POST = createChat().handler;
```

## Usage

```ts
export const maxDuration = 30;
export { POST } from '@peam-ai/next/route';
```

## Notes

* [withPeam](/docs/api-reference/next/with-peam) must run during build so `getConfig()` can resolve the search store settings.
* The handler reads the search index via the configured `SearchIndexStore` injected by the Next.js [createChat](/docs/api-reference/next/create-chat) wrapper.


## Sitemap
[Overview of all docs pages](/sitemap.md)
