diff options
| author | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-07-28 19:23:44 +0100 |
|---|---|---|
| committer | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-07-28 19:23:44 +0100 |
| commit | 24a505d2f7c47b837d4ada2569576af594975fce (patch) | |
| tree | a9bf16ada4d323d6763293142f9723953079ac1d /174bg/website/worker.js | |
| parent | 02b47120435f7953c5578f70f541d98a718e12bc (diff) | |
| download | unnamed-group-24a505d2f7c47b837d4ada2569576af594975fce.tar unnamed-group-24a505d2f7c47b837d4ada2569576af594975fce.tar.gz unnamed-group-24a505d2f7c47b837d4ada2569576af594975fce.tar.bz2 unnamed-group-24a505d2f7c47b837d4ada2569576af594975fce.tar.xz unnamed-group-24a505d2f7c47b837d4ada2569576af594975fce.zip | |
website w/ docker!
Diffstat (limited to '174bg/website/worker.js')
| -rw-r--r-- | 174bg/website/worker.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/174bg/website/worker.js b/174bg/website/worker.js deleted file mode 100644 index d5e2753..0000000 --- a/174bg/website/worker.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 |
