scoresaber-reloaded-backend/src/route/route.ts

35 lines
569 B
TypeScript
Raw Normal View History

2023-11-20 10:59:32 +00:00
import { Request, Response } from "express";
type RouteType = {
/**
* The path to handle
*/
path: string;
};
export abstract class Route {
private path: string;
constructor({ path }: RouteType) {
this.path = path;
console.log(`Created route handler for ${path}`);
}
/**
* Handle the incoming request
*
* @param req the request
* @param res the response
*/
abstract handle(req: Request, res: Response): void;
/**
* Get the path of the route
*
* @returns the path
*/
getPath() {
return this.path;
}
}