File size: 337 Bytes
1dded5e
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import { Hono } from "jsr:@hono/hono";
import { bearerAuth } from "jsr:@hono/hono/bearer-auth";
import { BlankEnv, BlankSchema } from "jsr:@hono/hono/types";

function auth(app: Hono<BlankEnv, BlankSchema, "/">) {
  const token = Deno.env.get("TOKEN");
  if (token) {
    app.use("/v1/*", bearerAuth({ token }));
  }
}

export { auth };