feature: initial commit

This commit is contained in:
Andy Burke 2025-06-24 15:40:30 -07:00
commit 2c27f003c9
15 changed files with 1601 additions and 0 deletions

18
utils/bodyparser.ts Normal file
View file

@ -0,0 +1,18 @@
export default async function parse_body(req: Request): Promise<any> {
switch (req.headers.get('content-type')) {
case 'application/x-www-form-urlencoded': {
const form_data = await req.formData();
const body: Record<string, any> = {};
const keys = form_data.keys();
for (const key of keys) {
body[key] = form_data.get(key);
}
return body;
}
case 'application/json':
default:
return req.json();
}
}