2022-06-03 10:54:30 +02:00
|
|
|
import express from 'express'
|
2020-02-13 11:49:03 +01:00
|
|
|
import { badRequest } from '../../helpers/utils'
|
2020-08-27 14:44:21 +02:00
|
|
|
import { configRouter } from './config'
|
2020-02-19 15:39:35 +01:00
|
|
|
import { searchChannelsRouter } from './search-channels'
|
2021-06-24 15:18:54 +02:00
|
|
|
import { searchPlaylistsRouter } from './search-playlists'
|
2020-08-27 14:44:21 +02:00
|
|
|
import { searchVideosRouter } from './search-videos'
|
2020-02-13 11:49:03 +01:00
|
|
|
|
|
|
|
const apiRouter = express.Router()
|
|
|
|
|
2020-08-27 14:44:21 +02:00
|
|
|
apiRouter.use('/', configRouter)
|
2020-02-19 15:39:35 +01:00
|
|
|
apiRouter.use('/', searchVideosRouter)
|
|
|
|
apiRouter.use('/', searchChannelsRouter)
|
2021-06-24 15:18:54 +02:00
|
|
|
apiRouter.use('/', searchPlaylistsRouter)
|
2020-02-13 11:49:03 +01:00
|
|
|
apiRouter.use('/ping', pong)
|
|
|
|
apiRouter.use('/*', badRequest)
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export { apiRouter }
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
function pong (req: express.Request, res: express.Response) {
|
|
|
|
return res.send('pong').status(200).end()
|
|
|
|
}
|