Something went wrong. Try again.
A CLI for publishing standard.site documents to ATProto
Something went wrong. Try again.
TypeScript
at sourcemaps
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253import { Hono } from "hono";import { cors } from "hono/cors";import { loadEnv } from "./env";import type { Env } from "./env";import { openDatabase } from "./lib/db";import auth from "./routes/auth";import subscribe from "./routes/subscribe";
const env = loadEnv();
const db = openDatabase(env.DATABASE_PATH);
type Variables = { env: Env; db: typeof db };
const app = new Hono<{ Variables: Variables }>();
// Inject env and db into all routesapp.use("*", async (c, next) => { c.set("env", env); c.set("db", db); await next();});
// Health checkapp.get("/api/health", (c) => c.json({ status: "ok" }));
// OAuth routesapp.route("/oauth", auth);
// Subscribe routes with CORSapp.use( "/subscribe/*", cors({ origin: (origin) => origin, credentials: true, }),);app.use( "/subscribe", cors({ origin: (origin) => origin, credentials: true, }),);app.route("/subscribe", subscribe);
console.log(`Sequoia server listening on port ${env.PORT}`);
export default { port: env.PORT, fetch: app.fetch,};