From ca71ab61414935a322c7f63f5aac84ec00b40c2d Mon Sep 17 00:00:00 2001 From: seaerchin Date: Thu, 30 May 2024 02:02:55 +0800 Subject: [PATCH] feat: setup isobot had to omit using shared middleware - not sure if this will impact anything. this is because bolt runs their own custom middleware and using our shared middleware for this path runs into errors. additionally, we might want to version it better --- support/index.ts | 5 ++++- support/routes/v2/index.ts | 3 --- support/routes/v2/isobot/index.ts | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/support/index.ts b/support/index.ts index 2b67d1e7d..6d4194767 100644 --- a/support/index.ts +++ b/support/index.ts @@ -8,6 +8,7 @@ import { config } from "@root/config/config" import logger from "@root/logger/logger" import { v2Router } from "./routes" +import { isobotRouter } from "./routes/v2/isobot" const BASE_PORT = config.get("port") const PORT = BASE_PORT + 1 @@ -16,8 +17,10 @@ const app = express() // poller site launch updates infraService.pollMessages() -useSharedMiddleware(app) +const ROUTE_PREFIX_ISOBOT = "/v2/isobot" +app.use(ROUTE_PREFIX_ISOBOT, isobotRouter) +useSharedMiddleware(app) app.use("/", v2Router) app.use("/v2/ping", (req, res) => res.status(200).send("Ok")) diff --git a/support/routes/v2/index.ts b/support/routes/v2/index.ts index b2e69c9b8..15016abdc 100644 --- a/support/routes/v2/index.ts +++ b/support/routes/v2/index.ts @@ -1,12 +1,9 @@ import express from "express" import { formSgRouter } from "./formsg" -import { isobotRouter } from "./isobot" const ROUTE_PREFIX = "/v2/infra" -const ROUTE_PREFIX_ISOBOT = "/v2/isobot" export const v2Router = express.Router() v2Router.use(ROUTE_PREFIX, formSgRouter) -v2Router.use(ROUTE_PREFIX_ISOBOT, isobotRouter) diff --git a/support/routes/v2/isobot/index.ts b/support/routes/v2/isobot/index.ts index f955c77d2..fd6c2875f 100644 --- a/support/routes/v2/isobot/index.ts +++ b/support/routes/v2/isobot/index.ts @@ -18,9 +18,7 @@ const botReceiver = new ExpressReceiver({ signingSecret, endpoints: "/" }) export const isobotRouter = botReceiver.router const bot = new App({ - signingSecret, token, - endpoints: "/", receiver: botReceiver, })