clayway-testapi.web.val.run
1
2
3
4
5
6
7
8
9
export async function testApi(request: Request): Promise<Response> {
if (request.method !== "POST") {
return Response.json({
error: "Method not allowed",
}, { status: 405 });
}
const body = await request.json();
return Response.json({ message: `You said: ${body.text}` });
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023