diff options
author | metamuffin <metamuffin@disroot.org> | 2022-09-07 10:20:44 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-09-07 10:20:44 +0200 |
commit | 832f48f29098cc6f840ade90db3b94efa67c6833 (patch) | |
tree | 5311a3c4d8ba0302bbe208bc33717dbfdc0deb10 /source/server/index.ts | |
parent | c347f41af4e7d82fc08ed068ed6f18f4a59e90ba (diff) | |
download | keks-meet-832f48f29098cc6f840ade90db3b94efa67c6833.tar keks-meet-832f48f29098cc6f840ade90db3b94efa67c6833.tar.bz2 keks-meet-832f48f29098cc6f840ade90db3b94efa67c6833.tar.zst |
about to refactor
Diffstat (limited to 'source/server/index.ts')
-rw-r--r-- | source/server/index.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/server/index.ts b/source/server/index.ts index f77d8a5..de2ba4e 100644 --- a/source/server/index.ts +++ b/source/server/index.ts @@ -5,6 +5,7 @@ import { bundle } from "https://deno.land/x/emit@0.1.1/mod.ts"; const app = new Application() const root = new Router() + root.get("/", async c => { await c.send({ path: "index.html", root: `${Deno.cwd()}/public` }) }) root.get("/room/:id", async c => { await c.send({ path: "index.html", root: `${Deno.cwd()}/public` }) }) @@ -26,17 +27,17 @@ function respondWithType(mimeType: string, f: () => string): (c: RouterContext<a let bundle_code = "" root.get("/bundle.js", respondWithType("application/javascript", () => bundle_code)) +root.use(api.routes()) + function mountFilesystem(r: Router, route: string, path: string) { r.get(route + "/(.*)", async (context) => { - await send(context, context.request.url.pathname, { root: Deno.cwd() + path }); + console.log(context.request.url.pathname.substring(route.length)); + await send(context, context.request.url.pathname.substring(route.length), { root: Deno.cwd() + path }); }) - } -mountFilesystem(root, "/style", "/public") -mountFilesystem(root, "/rnnoise", "/public") - -root.use(api.routes()) +mountFilesystem(root, "/_style", "/public/style") +mountFilesystem(root, "/_rnnoise", "/public/rnnoise") app.use(root.routes()) app.use(root.allowedMethods()) |