feat: add api prefix option

This commit is contained in:
Dragory 2024-04-06 11:54:31 +00:00
parent 899f743ed6
commit b40ed5ce49
No known key found for this signature in database
9 changed files with 27 additions and 22 deletions

View file

@ -3,15 +3,15 @@ import moment from "moment-timezone";
import { GuildArchives } from "../data/GuildArchives";
import { notFound } from "./responses";
export function initArchives(app: express.Express) {
export function initArchives(router: express.Router) {
const archives = new GuildArchives(null);
// Legacy redirect
app.get("/spam-logs/:id", (req: Request, res: Response) => {
router.get("/spam-logs/:id", (req: Request, res: Response) => {
res.redirect("/archives/" + req.params.id);
});
app.get("/archives/:id", async (req: Request, res: Response) => {
router.get("/archives/:id", async (req: Request, res: Response) => {
const archive = await archives.find(req.params.id);
if (!archive) return notFound(res);