Simple, single-user event aggregation platform, for use in personal websites and other related places.
event-streaming single-user events event-aggregation
at develop 15 lines 362 B view raw
1import { createMiddleware } from "hono/factory"; 2 3export const userAuth = createMiddleware(async (c, next) => { 4 const userToken = c.req.header("Authorization"); 5 6 if (!userToken) { 7 return c.json({ error: "Unauthorized" }, 401); 8 } 9 10 if (userToken !== process.env.USER_TOKEN) { 11 return c.json({ error: "Unauthorized" }, 401); 12 } 13 14 await next(); 15});