import * as express from "express"; import * as bodyParser from "body-parser"; import { CardRoutes } from "./rest/routes/services/cards"; import { AccountRoutes } from "./rest/routes/services/accounts"; import { InformationRoutes } from "./rest/routes/services/information"; import { CardRoutesDF } from "./rest/routes/dialog-flow/cards"; import { AccountRoutesDF } from "./rest/routes/dialog-flow/accounts"; import { InformationRoutesDF } from "./rest/routes/dialog-flow/information"; import { TranslateManager } from '@everisinnovationbot/shared'; import { SPANISH_TRANSLATIONS } from "./locales/es-ES"; import { ENGLISH_TRANSLATIONS } from "./locales/en-US"; ; class AppRest { public app: express.Application; public cardRoutes: CardRoutes = new CardRoutes(); public accountRoutes: AccountRoutes = new AccountRoutes(); public informationRoutes: InformationRoutes = new InformationRoutes(); public cardRoutesDF: CardRoutesDF = new CardRoutesDF(); public accountRoutesDF: AccountRoutesDF = new AccountRoutesDF(); public informationRoutesDF: InformationRoutesDF = new InformationRoutesDF(); public translateManager: TranslateManager = TranslateManager.getInstance(); constructor() { this.app = express(); this.config(); this.cardRoutes.routes(this.app); this.accountRoutes.routes(this.app); this.informationRoutes.routes(this.app); this.cardRoutesDF.routes(this.app); this.accountRoutesDF.routes(this.app); this.informationRoutesDF.routes(this.app); } private config(): void { // support application/json type post data this.app.use(bodyParser.json()); //support application/x-www-form-urlencoded post data this.app.use(bodyParser.urlencoded({ extended: false })); this.translateManager.config = { lang: 'es-ES', translations: { 'es-ES': SPANISH_TRANSLATIONS, 'en-US': ENGLISH_TRANSLATIONS } }; } } export default new AppRest().app;