This commit is contained in:
Puyodead1 2023-03-23 11:57:42 -04:00
parent 4a7811a25c
commit 6347a77a79
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
2 changed files with 55 additions and 36 deletions

View File

@ -16,21 +16,33 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { route } from "@spacebar/api";
import { Config } from "@spacebar/util"; import { Config } from "@spacebar/util";
import { Router, Response, Request } from "express"; import { Request, Response, Router } from "express";
import { route, RouteOptions } from "@spacebar/api";
const router = Router(); const router = Router();
const options: RouteOptions = { export interface GatewayBotResponse {
test: { url: string;
response: { shards: number;
session_start_limit: {
total: number;
remaining: number;
reset_after: number;
max_concurrency: number;
};
}
router.get(
"/",
route({
responses: {
200: {
body: "GatewayBotResponse", body: "GatewayBotResponse",
}, },
}, },
}; }),
(req: Request, res: Response) => {
router.get("/", route(options), (req: Request, res: Response) => {
const { endpointPublic } = Config.get().gateway; const { endpointPublic } = Config.get().gateway;
res.json({ res.json({
url: endpointPublic || process.env.GATEWAY || "ws://localhost:3001", url: endpointPublic || process.env.GATEWAY || "ws://localhost:3001",
@ -42,6 +54,7 @@ router.get("/", route(options), (req: Request, res: Response) => {
max_concurrency: 1, max_concurrency: 1,
}, },
}); });
}); },
);
export default router; export default router;

View File

@ -16,25 +16,31 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { route } from "@spacebar/api";
import { Config } from "@spacebar/util"; import { Config } from "@spacebar/util";
import { Router, Response, Request } from "express"; import { Request, Response, Router } from "express";
import { route, RouteOptions } from "@spacebar/api";
const router = Router(); const router = Router();
const options: RouteOptions = { export interface GatewayResponse {
test: { url: string;
response: { }
router.get(
"/",
route({
responses: {
200: {
body: "GatewayResponse", body: "GatewayResponse",
}, },
}, },
}; }),
(req: Request, res: Response) => {
router.get("/", route(options), (req: Request, res: Response) => {
const { endpointPublic } = Config.get().gateway; const { endpointPublic } = Config.get().gateway;
res.json({ res.json({
url: endpointPublic || process.env.GATEWAY || "ws://localhost:3001", url: endpointPublic || process.env.GATEWAY || "ws://localhost:3001",
}); });
}); },
);
export default router; export default router;