peertube-plugin-livechat/server/lib/routers/index.ts

18 lines
553 B
TypeScript
Raw Normal View History

2021-04-09 17:29:44 +00:00
import type { NextFunction, Request, Response } from 'express'
import { initWebchatRouter } from './webchat'
2021-04-09 19:28:16 +00:00
import { initSettingsRouter } from './settings'
2021-04-09 17:29:44 +00:00
2021-04-09 17:39:40 +00:00
async function initRouters (options: RegisterServerOptions): Promise<void> {
const { getRouter } = options
2021-04-09 17:29:44 +00:00
const router = getRouter()
router.get('/ping', (req: Request, res: Response, _next: NextFunction) => res.json({ message: 'pong' }))
2021-04-09 17:39:40 +00:00
router.use('/webchat', await initWebchatRouter(options))
2021-04-09 19:28:16 +00:00
router.use('/settings', await initSettingsRouter(options))
2021-04-09 17:29:44 +00:00
}
export {
initRouters
}