feat: scaffold cloudflare shortlinks app

This commit is contained in:
Hermes Agent
2026-06-20 09:57:13 +10:00
commit 32913619f4
14 changed files with 3051 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
export interface Env {}
const jsonHeaders = {
'content-type': 'application/json; charset=utf-8',
};
function json(body: unknown, init: ResponseInit = {}) {
return Response.json(body, {
...init,
headers: {
...jsonHeaders,
...init.headers,
},
});
}
export default {
async fetch(request): Promise<Response> {
const url = new URL(request.url);
if (url.pathname === '/api/health') {
return json({ ok: true, service: 'heygo-worker' });
}
if (url.pathname.startsWith('/api/')) {
return json({ error: 'Not found' }, { status: 404 });
}
return json({ error: 'Not found' }, { status: 404 });
},
} satisfies ExportedHandler<Env>;