17 lines
647 B
TypeScript
17 lines
647 B
TypeScript
|
import express from "express";
|
||
|
import GenericController from "../controller/GenericController";
|
||
|
import GenericService from "../services/GenericService";
|
||
|
import BaseEntity from "../entities/baseEntity";
|
||
|
|
||
|
export default class GenericRouter<
|
||
|
Controller extends GenericController<Service, Repository>,
|
||
|
Service extends GenericService<Repository>,
|
||
|
Repository extends BaseEntity
|
||
|
> {
|
||
|
public router = express.Router({ mergeParams: true });
|
||
|
constructor(protected controller: Controller) {
|
||
|
this.router.get("/", (req, res) => this.controller.getAll(req, res));
|
||
|
this.router.get("/:id", (req, res) => this.controller.getById(req, res));
|
||
|
}
|
||
|
}
|