Added the Sheepstar API to the Archive

This commit is contained in:
2022-09-06 16:37:56 +02:00
parent d6c272cdaf
commit bb78376745
36 changed files with 5346 additions and 0 deletions

View File

@ -0,0 +1,17 @@
const app = require('express').Router();
const axios = require('axios');
const {refreshToken} = require("../lib/discord");
app.get("/guilds", async (req, res) => {
const accessToken = await refreshToken(req.token);
try {
const {data} = await axios.get(DISCORD_USER_GUILDS_ENDPOINT, {
headers: {Authorization: "Bearer " + accessToken}
});
res.status(200).json(data);
} catch (e) {
res.status(500).json({message: "Something went wrong"});
}
});
module.exports = app;