feat: add api prefix option
This commit is contained in:
parent
899f743ed6
commit
b40ed5ce49
9 changed files with 27 additions and 22 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue