11 lines
364 B
TypeScript
11 lines
364 B
TypeScript
|
import { Request, Response } from "express";
|
||
|
import ForbiddenRequestException from "../exceptions/forbiddenRequestException";
|
||
|
|
||
|
export default async function preventApiAccess(req: Request, res: Response, next: Function) {
|
||
|
if (req.isWebApiRequest) {
|
||
|
throw new ForbiddenRequestException("This route cannot be accessed via webapi");
|
||
|
} else {
|
||
|
next();
|
||
|
}
|
||
|
}
|