mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
15 lines
492 B
TypeScript
15 lines
492 B
TypeScript
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);
|
|
});
|
|
}
|