A CLI for publishing standard.site documents to ATProto
sequoia.pub
standard
site
lexicon
cli
publishing
1import { Hono } from "hono";
2import { cors } from "hono/cors";
3import auth from "./routes/auth";
4import subscribe from "./routes/subscribe";
5import "./lib/path-redirect";
6
7type Bindings = {
8 ASSETS: Fetcher;
9 SEQUOIA_SESSIONS: KVNamespace;
10 CLIENT_URL: string;
11};
12
13const app = new Hono<{ Bindings: Bindings }>();
14
15app.use(
16 "/subscribe",
17 cors({
18 origin: (origin) => origin,
19 credentials: true,
20 }),
21);
22app.use(
23 "/subscribe/*",
24 cors({
25 origin: (origin) => origin,
26 credentials: true,
27 }),
28);
29
30app.route("/oauth", auth);
31app.route("/subscribe", subscribe);
32
33app.get("/api/health", (c) => {
34 return c.json({ status: "ok" });
35});
36
37app.all("*", (c) => {
38 return c.env.ASSETS.fetch(c.req.raw);
39});
40
41export default app;