import { 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(`
${config.description || "This is a simple auth server"}
`) }) 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)