Simple API gateway for webhooks
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import { Hono } from "hono"import { uaBlocker } from "@hono/ua-blocker"import { aiBots, useAiRobotsTxt } from "@hono/ua-blocker/ai-bots"import { config } from "../config.ts"import { sensors } from "./sensors.ts"import { kv } from "./util.ts"
const app = new Hono() .route("/sensors", sensors) .get("/robots.txt", useAiRobotsTxt()) .use( "*", uaBlocker({ blocklist: aiBots, }), ) .get("/", (ctx) => { return ctx.html(` <html> <head> <title>${config.title || "auth server"}</title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f5f5f5; display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100svh; } h1 { font-size: 3rem; color: #333; text-align: center; } p { font-size: 1.2rem; color: #666; text-align: center; } </style> </head> <body> <h1>${config.title || "auth server"}</h1> <p> ${config.description || "This is a simple auth server"} </p> </body> </html> `) })
// if (Deno.env.get("DENO_ENV") === "dev") {// const { default: data } = await import("../test.json", { with: { type: "json" } })// kv.set(// ["sensors", "latest"],// { ...data },// )// }
Deno.serve(app.fetch)