From 9c4ad4929c63b36e5ccc2930db6972a165c3a19b Mon Sep 17 00:00:00 2001 From: SimonFJ20 Date: Wed, 20 Nov 2024 15:49:59 +0100 Subject: [PATCH] add web --- web/deno.jsonc | 5 +++ web/deno.lock | 84 +++++++++++++++++++++++++++++++++++++++++++ web/main.ts | 21 +++++++++++ web/public/index.html | 9 +++++ 4 files changed, 119 insertions(+) create mode 100644 web/deno.jsonc create mode 100644 web/deno.lock create mode 100644 web/main.ts create mode 100644 web/public/index.html diff --git a/web/deno.jsonc b/web/deno.jsonc new file mode 100644 index 0000000..3fecf5f --- /dev/null +++ b/web/deno.jsonc @@ -0,0 +1,5 @@ +{ + "fmt": { + "indentWidth": 4 + } +} diff --git a/web/deno.lock b/web/deno.lock new file mode 100644 index 0000000..0b86c04 --- /dev/null +++ b/web/deno.lock @@ -0,0 +1,84 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@oak/commons@^1.0": "jsr:@oak/commons@1.0.0", + "jsr:@oak/oak": "jsr:@oak/oak@17.1.3", + "jsr:@std/assert@^1.0": "jsr:@std/assert@1.0.8", + "jsr:@std/bytes@^1.0": "jsr:@std/bytes@1.0.4", + "jsr:@std/bytes@^1.0.2": "jsr:@std/bytes@1.0.4", + "jsr:@std/crypto@^1.0": "jsr:@std/crypto@1.0.3", + "jsr:@std/encoding@^1.0": "jsr:@std/encoding@1.0.5", + "jsr:@std/encoding@^1.0.5": "jsr:@std/encoding@1.0.5", + "jsr:@std/http@^1.0": "jsr:@std/http@1.0.10", + "jsr:@std/io@0.224": "jsr:@std/io@0.224.9", + "jsr:@std/media-types@^1.0": "jsr:@std/media-types@1.1.0", + "jsr:@std/path@^1.0": "jsr:@std/path@1.0.8", + "npm:path-to-regexp@6.2.1": "npm:path-to-regexp@6.2.1" + }, + "jsr": { + "@oak/commons@1.0.0": { + "integrity": "49805b55603c3627a9d6235c0655aa2b6222d3036b3a13ff0380c16368f607ac", + "dependencies": [ + "jsr:@std/assert@^1.0", + "jsr:@std/bytes@^1.0", + "jsr:@std/crypto@^1.0", + "jsr:@std/encoding@^1.0", + "jsr:@std/http@^1.0", + "jsr:@std/media-types@^1.0" + ] + }, + "@oak/oak@17.1.3": { + "integrity": "d89296c22db91681dd3a2a1e1fd14e258d0d5a9654de55637aee5b661c159f33", + "dependencies": [ + "jsr:@oak/commons@^1.0", + "jsr:@std/assert@^1.0", + "jsr:@std/bytes@^1.0", + "jsr:@std/crypto@^1.0", + "jsr:@std/http@^1.0", + "jsr:@std/io@0.224", + "jsr:@std/media-types@^1.0", + "jsr:@std/path@^1.0", + "npm:path-to-regexp@6.2.1" + ] + }, + "@std/assert@1.0.8": { + "integrity": "ebe0bd7eb488ee39686f77003992f389a06c3da1bbd8022184804852b2fa641b" + }, + "@std/bytes@1.0.4": { + "integrity": "11a0debe522707c95c7b7ef89b478c13fb1583a7cfb9a85674cd2cc2e3a28abc" + }, + "@std/crypto@1.0.3": { + "integrity": "a2a32f51ddef632d299e3879cd027c630dcd4d1d9a5285d6e6788072f4e51e7f" + }, + "@std/encoding@1.0.5": { + "integrity": "ecf363d4fc25bd85bd915ff6733a7e79b67e0e7806334af15f4645c569fefc04" + }, + "@std/http@1.0.10": { + "integrity": "4e32d11493ab04e3ef09f104f0cb9beb4228b1d4b47c5469573c2c294c0d3692", + "dependencies": [ + "jsr:@std/encoding@^1.0.5" + ] + }, + "@std/io@0.224.9": { + "integrity": "4414664b6926f665102e73c969cfda06d2c4c59bd5d0c603fd4f1b1c840d6ee3", + "dependencies": [ + "jsr:@std/bytes@^1.0.2" + ] + }, + "@std/media-types@1.1.0": { + "integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4" + }, + "@std/path@1.0.8": { + "integrity": "548fa456bb6a04d3c1a1e7477986b6cffbce95102d0bb447c67c4ee70e0364be" + } + }, + "npm": { + "path-to-regexp@6.2.1": { + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", + "dependencies": {} + } + } + }, + "remote": {} +} diff --git a/web/main.ts b/web/main.ts new file mode 100644 index 0000000..20d6257 --- /dev/null +++ b/web/main.ts @@ -0,0 +1,21 @@ +import { Application, Router } from "jsr:@oak/oak"; + +const app = new Application(); + +const router = new Router(); + +app.use(router.routes()); +app.use(router.allowedMethods()); + +app.use(async (ctx, next) => { + try { + await ctx.send({ root: "./public", index: "index.html" }); + } catch { + next(); + } +}); + +const port = 8000; +const listener = app.listen({ port }); +console.log(`Listening at http://localhost:${port}/`); +await listener; diff --git a/web/public/index.html b/web/public/index.html new file mode 100644 index 0000000..ffee46f --- /dev/null +++ b/web/public/index.html @@ -0,0 +1,9 @@ + + + + + + +

slige

+ +