MCPcopy
hub / github.com/whoiskatrin/sql-translator / handler

Function handler

pages/api/sql-to-human.ts:10–29  ·  view source on GitHub ↗
(
  req: NextApiRequest,
  res: NextApiResponse
)

Source from the content-addressed store, hash-verified

8}
9
10export default async function handler(
11 req: NextApiRequest,
12 res: NextApiResponse
13) {
14 if (req.method !== "POST") {
15 return res.status(405).json({ message: "Method not allowed" });
16 }
17
18 const { inputText } = req.body;
19 try {
20 const outputText = await translateToHuman(
21 inputText,
22 process.env.OPENAI_API_KEY
23 );
24 res.status(200).json({ outputText });
25 } catch (error) {
26 console.error(error);
27 res.status(500).json({ message: "Error translating to natural language" });
28 }
29}

Callers

nothing calls this directly

Calls 1

translateToHumanFunction · 0.85

Tested by

no test coverage detected