1
0
Fork 0
peertube/server/controllers/api/index.js

36 lines
993 B
JavaScript
Raw Normal View History

'use strict'
2015-06-09 11:41:40 -04:00
2016-03-16 17:29:27 -04:00
const express = require('express')
2016-01-31 05:23:52 -05:00
2016-03-16 17:29:27 -04:00
const router = express.Router()
2015-06-09 11:41:40 -04:00
2016-08-05 10:09:39 -04:00
const clientsController = require('./clients')
2016-03-16 17:29:27 -04:00
const podsController = require('./pods')
const remoteController = require('./remote')
2016-09-19 15:33:46 -04:00
const requestsController = require('./requests')
2016-03-21 06:56:33 -04:00
const usersController = require('./users')
2016-03-16 17:29:27 -04:00
const videosController = require('./videos')
2016-02-07 05:47:30 -05:00
2016-08-05 10:09:39 -04:00
router.use('/clients', clientsController)
2016-02-07 05:47:30 -05:00
router.use('/pods', podsController)
router.use('/remote', remoteController)
2016-09-19 15:33:46 -04:00
router.use('/requests', requestsController)
2016-03-21 06:56:33 -04:00
router.use('/users', usersController)
2016-02-07 05:47:30 -05:00
router.use('/videos', videosController)
router.use('/ping', pong)
2016-03-07 12:53:03 -05:00
router.use('/*', badRequest)
2016-01-31 05:23:52 -05:00
// ---------------------------------------------------------------------------
2015-11-07 12:22:05 -05:00
module.exports = router
2016-03-07 12:53:03 -05:00
// ---------------------------------------------------------------------------
function pong (req, res, next) {
return res.send('pong').status(200).end()
}
2016-03-07 12:53:03 -05:00
function badRequest (req, res, next) {
2016-03-14 08:50:19 -04:00
res.type('json').status(400).end()
2016-03-07 12:53:03 -05:00
}