Skip to content

Commit

Permalink
feat: setup isobot
Browse files Browse the repository at this point in the history
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
  • Loading branch information
seaerchin committed May 29, 2024
1 parent 55c2d86 commit ca71ab6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 4 additions & 1 deletion support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))

Expand Down
3 changes: 0 additions & 3 deletions support/routes/v2/index.ts
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 0 additions & 2 deletions support/routes/v2/isobot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ const botReceiver = new ExpressReceiver({ signingSecret, endpoints: "/" })
export const isobotRouter = botReceiver.router

const bot = new App({
signingSecret,
token,
endpoints: "/",
receiver: botReceiver,
})

Expand Down

0 comments on commit ca71ab6

Please sign in to comment.