import { Request, Response } from "express"; import { CardService } from "@everisinnovationbot/banc_sabadell_services"; export class CardRoutes { private cardService: CardService; constructor() { this.cardService = new CardService(); } public routes(app): void { app.route('/cards') .get((req: Request, res: Response) => { this.cardService.getCards('').then(cards => { if(cards){ res.status(200).send(cards); } else { res.status(400).send('Error'); } }) }) app.route('/cards/:last4') .get((req: Request, res: Response) => { this.cardService.getCardDetail(req.params.last4,'').then(card => { if (card) { res.status(200).send(card); } else { res.status(400).send('Error'); } }) }) } }