aboutsummaryrefslogtreecommitdiff
path: root/src/handler
diff options
context:
space:
mode:
authorMarvin Borner2020-07-18 22:37:00 +0200
committerMarvin Borner2020-07-18 22:38:45 +0200
commitaccb147b54bc99e5cd20059be5cb333031f15885 (patch)
tree8523ad288cb4fbf84acd6a646bd7c04957298bf4 /src/handler
parentd3c4b447c3d882a77282e32d9e12d7c3d4f034a2 (diff)
Added user registration
Co-authored-by: LarsVomMars <lars@kroenner.eu>
Diffstat (limited to 'src/handler')
-rw-r--r--src/handler/user.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/handler/user.ts b/src/handler/user.ts
index fe65eaa..9881439 100644
--- a/src/handler/user.ts
+++ b/src/handler/user.ts
@@ -2,8 +2,16 @@ 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);
+ const success = await db.createUser(email, username, password);
+ // TODO: Send email
+ return { success };
+};
-}
+export const login: HandlerFunc = async (c: Context) => {
+ const { username, password } = await c.body();
+ const success = await db.login(username, password);
+ return { success };
+};