first commit
This commit is contained in:
commit
0b5c823408
89 files changed
+54090
No files matched your search
@@ -0,0 +1,15 @@
|
||||
// Public, credential-free, stateless endpoint; independent of the mapped physical function name.
|
||||
export function handler(request: Request): Response {
|
||||
const headers = { "Cache-Control": "no-store" };
|
||||
if (request.method !== "GET") {
|
||||
return Response.json(
|
||||
{ ok: false, error: "method_not_allowed" },
|
||||
{ status: 405, headers: { ...headers, Allow: "GET" } },
|
||||
);
|
||||
}
|
||||
const name = new URL(request.url).searchParams.get("name")?.trim() ?? "Visitor";
|
||||
if (!name || name.length > 80) {
|
||||
return Response.json({ ok: false, error: "invalid_name" }, { status: 400, headers });
|
||||
}
|
||||
return Response.json({ ok: true, message: `Hello, ${name}!` }, { headers });
|
||||
}
|
||||
Reference in new issue
Block a user