aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
blob: 119ea919f308732f4f408c90148e568f08903d16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { Elysia } from "elysia";
import postgres from "postgres";

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(
  `listening at ${app.server?.hostname}:${app.server?.port}`
);