Init backend, frontend and DB schema

This commit is contained in:
2024-08-03 10:44:42 +02:00
parent ddd7f7221b
commit 777038e0b4
23 changed files with 1917 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import { Effect } from "effect";
import { Request } from "./services/request";
import { Storage } from "./services/storage";
const match = (method: string, ...pattern: readonly string[]) => Effect.gen(function* () {
const req = yield* Request;
return req.method === method
&& req.path.length === pattern.length
&& pattern.every((x, i) => x === "*" || x === req.path[i]);
});
export const app = Effect.gen(function* () {
const req = yield* Request;
const storage = yield* Storage;
if (yield* match("GET", "ping")) {
return new Response("pong", {
headers: {
"Content-Length": "4",
"Content-Type": "text/plain;charset=utf-8",
},
});
}
return new Response(null, { status: 404 });
});