import { Router , Request , Response } from "express" ; import { Author } from "../../models/author/model" ; export class AuthorRouter { private router : Router = Router ( ) ; getRouter ( ) { swagger this . router . get ( "/author" , async ( request , response ) => { const authors = await Author . find ( { } ) . exec ( ) ; response . json ( authors ) ; } ) ; swagger this . router . post ( "/author" , async ( request , response ) => { const author = await Author . create ( request . body ) ; response . status ( 200 ) . json ( author ) ; } ) ; return this . router ; } }