MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / POST

Function POST

examples/nextjs/app/api/langbase/pipes/run/route.ts:5–32  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

3import pipeSummary from '../../../../../baseai/pipes/summary';
4
5export async function POST(req: NextRequest) {
6 const runOptions = await req.json();
7
8 // 1. Initiate the Pipe.
9 const pipe = new Pipe(pipeSummary());
10
11 // 2. Run the pipe
12 try {
13 const result = await pipe.run(runOptions);
14
15 // 3. Return the response stringified.
16 return new Response(JSON.stringify(result));
17 } catch (error: any) {
18 // 4. Return the error response
19
20 return new Response(
21 JSON.stringify({
22 error,
23 }),
24 {
25 status: error.status || 500,
26 headers: {
27 'Content-Type': 'application/json',
28 },
29 },
30 );
31 }
32}

Callers

nothing calls this directly

Calls 2

runMethod · 0.95
pipeSummaryFunction · 0.50

Tested by

no test coverage detected