aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/api/v1/pods.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2015-11-06 17:34:15 +0100
committerChocobozzz <florian.bigard@gmail.com>2015-11-06 17:34:31 +0100
commitf5a60a5138135a3412dfbcfd6e564f7aa47a55c2 (patch)
tree2516f410a33792f9112b4b4253929e5292908a3f /routes/api/v1/pods.js
parenta6fa7ac141637a5026388157084c439f920c5ff1 (diff)
downloadPeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.tar.gz
PeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.tar.zst
PeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.zip
Add API versionning
Diffstat (limited to 'routes/api/v1/pods.js')
-rw-r--r--routes/api/v1/pods.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/routes/api/v1/pods.js b/routes/api/v1/pods.js
new file mode 100644
index 000000000..961388fcb
--- /dev/null
+++ b/routes/api/v1/pods.js
@@ -0,0 +1,38 @@
1;(function () {
2 'use strict'
3
4 var express = require('express')
5 var router = express.Router()
6 var middleware = require('../../../middlewares')
7 var pods = require('../../../src/pods')
8
9 function listPods (req, res, next) {
10 pods.list(function (err, pods_list) {
11 if (err) return next(err)
12
13 res.json(pods_list)
14 })
15 }
16
17 function addPods (req, res, next) {
18 pods.add(req.body.data, function (err, json) {
19 if (err) return next(err)
20
21 res.json(json)
22 })
23 }
24
25 function makeFriends (req, res, next) {
26 pods.makeFriends(function (err) {
27 if (err) return next(err)
28
29 res.sendStatus(204)
30 })
31 }
32
33 router.get('/', middleware.cache(false), listPods)
34 router.get('/makefriends', middleware.cache(false), makeFriends)
35 router.post('/', middleware.cache(false), addPods)
36
37 module.exports = router
38})()