sepia-search-motore-di-rice.../server/controllers/api/index.ts

22 lines
663 B
TypeScript

import * as express from 'express'
import { badRequest } from '../../helpers/utils'
import { searchVideosRouter } from './search-videos'
import { searchChannelsRouter } from './search-channels'
const apiRouter = express.Router()
apiRouter.use('/', searchVideosRouter)
apiRouter.use('/', searchChannelsRouter)
apiRouter.use('/ping', pong)
apiRouter.use('/*', badRequest)
// ---------------------------------------------------------------------------
export { apiRouter }
// ---------------------------------------------------------------------------
function pong (req: express.Request, res: express.Response) {
return res.send('pong').status(200).end()
}