From 1f1527de088096239c4915dd8421dd49b2c2aadb Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Sun, 26 Jul 2026 13:16:16 +0100 Subject: better org --- 174bg/www/server/index.js | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 174bg/www/server/index.js (limited to '174bg/www/server/index.js') diff --git a/174bg/www/server/index.js b/174bg/www/server/index.js deleted file mode 100644 index d5e2753..0000000 --- a/174bg/www/server/index.js +++ /dev/null @@ -1,45 +0,0 @@ -const configuration = { - redirects: [ - { from: "/discord", to: "https://discord.gg/RGgSfVj4DD" }, - { from: "/handbook", to: "https://handbook.174bg.net" }, - { from: "/docs", to: "https://handbook.174bg.net" }, - { from: "/manager", to: "https://manager.174bg.net" }, - { from: "/login", to: "https://manager.174bg.net" }, - { from: "/database", to: "https://db.174bg.net" }, - { from: "/db", to: "https://db.174bg.net" }, - ], -}; - -export default { - /** - * Fetch event handler, this function will be called whenever a request is made to the worker. The function will parse the request and return a response based on the request path. - * - * @param {Request} request - the incoming request object - * @param {Environment} environment - the environment object - * @param {Context} context - the context object - * - * @returns {Response} a new Response object - */ - async fetch(request, environment, context) { - const url = new URL(request.url); - - if (configuration.redirects) { - for (const redirect of configuration.redirects) { - if ( - url.pathname === redirect.from || - url.pathname === redirect.from + "/" - ) { - return Response.redirect(redirect.to, 301); - } - } - } - - if (url.pathname.startsWith("/api")) { - return new Response("Hello from the API!", { - headers: { "Content-Type": "text/plain" }, - }); - } - - return environment.ASSETS.fetch(new Request(url, request)); - } -}; \ No newline at end of file -- cgit v1.2.3