diff options
Diffstat (limited to 'src/index.ts')
-rw-r--r-- | src/index.ts | 15 |
1 files changed, 13 insertions, 2 deletions
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}` ); |