aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/index.js
blob: 4cb65ed55d0e7ba5ce297de4f88804a7aa8272c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict'

const express = require('express')

const router = express.Router()

const clientsController = require('./clients')
const podsController = require('./pods')
const remoteController = require('./remote')
const requestsController = require('./requests')
const usersController = require('./users')
const videosController = require('./videos')

router.use('/clients', clientsController)
router.use('/pods', podsController)
router.use('/remote', remoteController)
router.use('/requests', requestsController)
router.use('/users', usersController)
router.use('/videos', videosController)
router.use('/ping', pong)
router.use('/*', badRequest)

// ---------------------------------------------------------------------------

module.exports = router

// ---------------------------------------------------------------------------

function pong (req, res, next) {
  return res.send('pong').status(200).end()
}

function badRequest (req, res, next) {
  res.type('json').status(400).end()
}