From 96982b85e23af2a24841c3c44e598ae71f78abf6 Mon Sep 17 00:00:00 2001 From: Shav Kinderlehrer Date: Sun, 15 Oct 2023 00:14:32 -0400 Subject: Implement get --- src/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts index 9c1f7a1..119ea91 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,18 @@ import { Elysia } from "elysia"; +import postgres from "postgres"; -const app = new Elysia().get("/", () => "Hello Elysia").listen(3000); +import { get_home, get_id } from "./get"; + +const sql = postgres(); + +const app = new Elysia() + .get("/", ({ headers }) => get_home({ headers: headers })) + .get("/:id", async ({ params, headers, }) => get_id( + { params: params, headers: headers }, sql) + ) + +app.listen(3000) console.log( - `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}` + `listening at ${app.server?.hostname}:${app.server?.port}` ); -- cgit v1.2.3