feat: Move API to CF workers (WIP)

This commit is contained in:
Wanjohi
2025-09-27 10:25:13 +03:00
parent 5705029972
commit 278c1043f5
8 changed files with 66 additions and 16 deletions

12
cloud/infra/api.ts Normal file
View File

@@ -0,0 +1,12 @@
import { urls } from "./urls";
import { auth } from "./auth";
import { domain } from "./stage";
import { secret } from "./secrets";
import { database } from "./database";
export const api = new sst.cloudflare.Worker("Api", {
url: true,
domain: `api.${domain}`,
handler: "cloud/packages/functions/src/api/index.ts",
link: [database, secret.POLAR_API_KEY, urls, auth],
});

10
cloud/infra/urls.ts Normal file
View File

@@ -0,0 +1,10 @@
import { domain } from "./stage";
export const urls = new sst.Linkable("Urls", {
properties: {
api: "https://api." + domain,
auth: "https://auth." + domain,
site: $dev ? "http://localhost:4321" : "https://" + domain,
openapi: "https://api." + domain + "/doc",
},
});