From 985763e3fcb6762fa76b81c059a97648905b3761 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 18 Jul 2020 21:54:58 +0200 Subject: Started fileview --- src/handler/fileView.ts | 6 ++++++ src/handler/user.ts | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 src/handler/fileView.ts (limited to 'src/handler') diff --git a/src/handler/fileView.ts b/src/handler/fileView.ts new file mode 100644 index 0000000..90c7176 --- /dev/null +++ b/src/handler/fileView.ts @@ -0,0 +1,6 @@ +import type { HandlerFunc, Context } from "https://deno.land/x/abc@master/mod.ts"; +import { cleanPath } from "../util/files.ts"; + +export const handlePath: HandlerFunc = async (c: Context) => { + return await c.render("./src/views/index.html", { path: cleanPath(c.path) }); +}; diff --git a/src/handler/user.ts b/src/handler/user.ts index 28d6fbd..fe65eaa 100644 --- a/src/handler/user.ts +++ b/src/handler/user.ts @@ -2,3 +2,8 @@ import type { HandlerFunc, Context } from "https://deno.land/x/abc@master/mod.ts import db from "../db/user.ts"; export const index: HandlerFunc = async (c: Context) => c.params.name; +export const register: HandlerFunc = async (c: Context) => { + const { username, email, password } = await c.body(); + await db.createUser(email, username, password); + +} -- cgit v1.2.3