feat: initial test static site with Deno backend
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// GET /api/hello — returns a greeting.
|
||||
// Demonstrates reading query parameters and using env vars.
|
||||
export async function API_get(req: Request): Promise<Response> {
|
||||
const url = new URL(req.url);
|
||||
const name = url.searchParams.get("name") || "World";
|
||||
|
||||
// Example: reading a secret from environment (configured in Docker Watcher).
|
||||
const prefix = Deno.env.get("GREETING_PREFIX") || "Hello";
|
||||
|
||||
return Response.json({
|
||||
message: `${prefix}, ${name}!`,
|
||||
served_by: "Deno on Docker Watcher",
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user