-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
31 lines (26 loc) · 600 Bytes
/
index.ts
File metadata and controls
31 lines (26 loc) · 600 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { create } from "@kaito-http/core";
import { fami } from "fami/kaito";
const kaito = create({
getContext: () => ({
test: 1,
}),
}).pipe(
fami({
session: { maxAge: 60 * 60 },
}),
);
const app = kaito
.get("/", ({ ctx }) => ctx.cookies)
.get("/set-cookie", ({ ctx }) => {
ctx.setCookie("session", new Date().toISOString());
const _: number = ctx.test;
return "Cookie set";
})
.get("/delete-cookie", ({ ctx }) => {
ctx.deleteCookie("session");
return "Cookie deleted";
});
const server = Bun.serve({
fetch: app.serve(),
});
console.log(`Listening on ${server.url}`);