3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00
zeppelin/src/api/guilds.ts

16 lines
492 B
TypeScript
Raw Normal View History

import express from "express";
import passport from "passport";
import { AllowedGuilds } from "../data/AllowedGuilds";
export function initGuildsAPI(app: express.Express) {
const guildAPIRouter = express.Router();
guildAPIRouter.use(passport.authenticate("api-token"));
const allowedGuilds = new AllowedGuilds();
guildAPIRouter.get("/guilds/available", async (req, res) => {
const guilds = await allowedGuilds.getForDashboardUser(req.user.userId);
res.end(guilds);
});
}