From c55a9e8b987a6923b3dc5c86431d80ae6f80b656 Mon Sep 17 00:00:00 2001 From: dylan <> Date: Sun, 29 Oct 2023 17:54:20 -0700 Subject: [PATCH] add webhook endpoint --- src/server/api/webhook.ts | 19 +++++++++++++++++++ src/server/routelist.ts | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 src/server/api/webhook.ts diff --git a/src/server/api/webhook.ts b/src/server/api/webhook.ts new file mode 100644 index 0000000..3379394 --- /dev/null +++ b/src/server/api/webhook.ts @@ -0,0 +1,19 @@ +import { Type } from "@sinclair/typebox"; +import { FirRouteInput, FirRouteOptions } from "../util/routewrap.js"; + +const method = "POST"; +const url = "/api/webhook-gh"; + +const payloadT = Type.Any(); + +const handler = ({payload}: FirRouteInput) => { + console.log(payload); + return {}; +}; + +export default { + method, + url, + payloadT, + handler, +} as const satisfies FirRouteOptions; \ No newline at end of file diff --git a/src/server/routelist.ts b/src/server/routelist.ts index ee9b634..fbba4b4 100644 --- a/src/server/routelist.ts +++ b/src/server/routelist.ts @@ -1,7 +1,9 @@ import echo from "./api/echo.ts"; +import webhook from "./api/webhook.ts"; export const routeList = [ echo, + webhook, ]; export type RouteList = typeof routeList; \ No newline at end of file