From 125f91632f0607903596fff3aeaf67d3df593ec7 Mon Sep 17 00:00:00 2001 From: Hayden Young Date: Fri, 15 Oct 2021 11:05:51 +0000 Subject: feat: add tests to gateway routes, split into own routers --- api/src/routes/gateway/bot.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 api/src/routes/gateway/bot.ts (limited to 'api/src/routes/gateway/bot.ts') diff --git a/api/src/routes/gateway/bot.ts b/api/src/routes/gateway/bot.ts new file mode 100644 index 00000000..3a038276 --- /dev/null +++ b/api/src/routes/gateway/bot.ts @@ -0,0 +1,40 @@ +import { Config } from "@fosscord/util"; +import { Router, Response, Request } from "express"; +import { route, RouteOptions } from "@fosscord/api"; + +const router = Router(); + +export interface GatewayBotResponse { + url: string; + shards: number; + session_start_limit: { + total: number; + remaining: number; + reset_after: number; + max_concurrency: number; + } +} + +const options: RouteOptions = { + test: { + response: { + body: "GatewayBotResponse" + } + } +}; + +router.get("/bot", route(options), (req: Request, res: Response) => { + const { endpointPublic } = Config.get().gateway; + res.json({ + url: endpointPublic || process.env.GATEWAY || "ws://localhost:3002", + shards: 1, + session_start_limit: { + total: 1000, + remaining: 999, + reset_after: 14400000, + max_concurrency: 1 + } + }); +}); + +export default router; -- cgit 1.5.1 From d6188037700db5b7bceeff3a0da084bff0dfcd73 Mon Sep 17 00:00:00 2001 From: Chris Chrome Date: Sat, 16 Oct 2021 09:43:21 -0400 Subject: Fix /gateway/bot https://canary.discord.com/channels/806142446094385153/806142446529806367/898928295771521125 --- api/src/routes/gateway/bot.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api/src/routes/gateway/bot.ts') diff --git a/api/src/routes/gateway/bot.ts b/api/src/routes/gateway/bot.ts index 3a038276..72313700 100644 --- a/api/src/routes/gateway/bot.ts +++ b/api/src/routes/gateway/bot.ts @@ -23,7 +23,7 @@ const options: RouteOptions = { } }; -router.get("/bot", route(options), (req: Request, res: Response) => { +router.get("/", route(options), (req: Request, res: Response) => { const { endpointPublic } = Config.get().gateway; res.json({ url: endpointPublic || process.env.GATEWAY || "ws://localhost:3002", -- cgit 1.5.1