Simple API gateway for webhooks

log what's received

finxol.io d71ba0ab a07f128b

verified
Changed files
+12 -1
src
+2
src/main.ts
···
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"
const app = new Hono()
+
.route("/sensors", sensors)
.get("/robots.txt", useAiRobotsTxt())
.use(
"*",
+10 -1
src/sensors.ts
···
import { Hono } from "hono"
-
export const app = new Hono().get("/", (c) => c.text("Hello World!"))
+
const sensors = new Hono().get("/get", (c) => c.text("Hello World!")).post(
+
"/set",
+
async (c) => {
+
const body = await c.req.text()
+
console.log(body)
+
return c.text(`Received: ${body}`)
+
},
+
)
+
+
export { sensors }