forked from denniske/aoe2backend-deno
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
27 lines (24 loc) · 778 Bytes
/
index.ts
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
import { serve } from "https://deno.land/std@0.140.0/http/server.ts";
import { PrismaClient } from './generated/client/deno/edge.ts'
const prisma = new PrismaClient()
async function handler(request: Request) {
// const log = await prisma.log.create({
// data: {
// level: 'Info',
// message: `${request.method} ${request.url}`,
// meta: {
// headers: JSON.stringify(request.headers),
// },
// },
// })
const log = await prisma.api_key.create({
data: {
api_key: 'Info',
},
})
const body = JSON.stringify(log, null, 2);
return new Response(body, {
headers: { "content-type": "application/json; charset=utf-8" },
});
}
serve(handler);