_index.ts 599 Bytes
Newer Older
chinguyen's avatar
chinguyen committed
1 2 3 4
import * as winston from 'winston'
import { Express, Request, Response } from 'express'
import * as LanguagesRoutes from './languages'
import * as AppUserRoutes from './appusers'
chinguyen's avatar
chinguyen committed
5
import * as StudentsRoutes from './students'
chinguyen's avatar
chinguyen committed
6 7 8 9 10 11 12 13 14 15

export function initRoutes(app: Express) {
  winston.log('info', '--> Initialisations des routes')

  app.get('/api', (req: Request, res: Response) => res.status(200).send({
    message: 'server is running!'
  }))

  LanguagesRoutes.routes(app)
  AppUserRoutes.routes(app)
chinguyen's avatar
chinguyen committed
16
  StudentsRoutes.routes(app)
chinguyen's avatar
chinguyen committed
17 18 19

  app.all('*', (req: Request, res: Response) => res.boom.notFound())
}