Files
2023-11-14 17:56:44 +00:00

35 lines
569 B
TypeScript

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;
}
}