Simple API gateway for webhooks

log what's received

finxol.io d71ba0ab a07f128b

verified
+12 -1
+2
src/main.ts
··· 2 2 import { uaBlocker } from "@hono/ua-blocker" 3 3 import { aiBots, useAiRobotsTxt } from "@hono/ua-blocker/ai-bots" 4 4 import { config } from "../config.ts" 5 + import { sensors } from "./sensors.ts" 5 6 6 7 const app = new Hono() 8 + .route("/sensors", sensors) 7 9 .get("/robots.txt", useAiRobotsTxt()) 8 10 .use( 9 11 "*",
+10 -1
src/sensors.ts
··· 1 1 import { Hono } from "hono" 2 2 3 - export const app = new Hono().get("/", (c) => c.text("Hello World!")) 3 + const sensors = new Hono().get("/get", (c) => c.text("Hello World!")).post( 4 + "/set", 5 + async (c) => { 6 + const body = await c.req.text() 7 + console.log(body) 8 + return c.text(`Received: ${body}`) 9 + }, 10 + ) 11 + 12 + export { sensors }