From 2131d5fec97f6163678fdec40dd2d6e9f7a5e58c Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Thu, 30 Oct 2025 23:40:37 +0000 Subject: restructure repo into a monorepo --- projects/www/server/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/www/server/index.js (limited to 'projects/www/server/index.js') diff --git a/projects/www/server/index.js b/projects/www/server/index.js new file mode 100644 index 0000000..10151ea --- /dev/null +++ b/projects/www/server/index.js @@ -0,0 +1,25 @@ +export default { + async fetch(request, env) { + const url = new URL(request.url); + + if (url.pathname.startsWith("/api")) { + const apiPath = url.pathname.split("/").filter(Boolean); + + if (!apiPath[1]) apiPath[1] = "index"; + + switch (apiPath[1]) { + case "index": + return new Response(JSON.stringify({ message: "Hello, World! :3" }), { + headers: { "Content-Type": "application/json" }, + }); + default: + return new Response(JSON.stringify({ message: "Not Found" }), { + status: 404, + headers: { "Content-Type": "application/json" }, + }); + } + } + + return env.ASSETS.fetch(request); + }, +}; \ No newline at end of file -- cgit v1.2.3