HttpHandler.ts 667 B

123456789101112131415161718192021222324252627282930313233
  1. abstract class HttpHandler {
  2. protected abstract order: number;
  3. protected abstract route: string | null;
  4. protected abstract action: (...any: any[]) => any;
  5. protected context: any;
  6. public constructor(context: Record<string, any>) {
  7. this.context = context ?? null;
  8. }
  9. public setContext(context: Record<string, any>): HttpHandler {
  10. this.context = context;
  11. return this;
  12. }
  13. public getContext(): Record<string, any> {
  14. return this.context;
  15. }
  16. public getRoute(): string | null {
  17. return this.route;
  18. }
  19. public getAction(): (...any: any[]) => any {
  20. return this.action;
  21. }
  22. public getOrder(): number {
  23. return this.order;
  24. }
  25. }
  26. export { HttpHandler };