diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2015-11-06 17:34:15 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2015-11-06 17:34:31 +0100 |
commit | f5a60a5138135a3412dfbcfd6e564f7aa47a55c2 (patch) | |
tree | 2516f410a33792f9112b4b4253929e5292908a3f /server.js | |
parent | a6fa7ac141637a5026388157084c439f920c5ff1 (diff) | |
download | PeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.tar.gz PeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.tar.zst PeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.zip |
Add API versionning
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,6 +1,9 @@ | |||
1 | ;(function () { | 1 | ;(function () { |
2 | 'use strict' | 2 | 'use strict' |
3 | 3 | ||
4 | // ----------- Constantes ----------- | ||
5 | global.API_VERSION = 'v1' | ||
6 | |||
4 | // ----------- Node modules ----------- | 7 | // ----------- Node modules ----------- |
5 | var express = require('express') | 8 | var express = require('express') |
6 | var path = require('path') | 9 | var path = require('path') |
@@ -28,7 +31,7 @@ | |||
28 | var config = require('config') | 31 | var config = require('config') |
29 | var logger = require('./src/logger') | 32 | var logger = require('./src/logger') |
30 | var routes = require('./routes') | 33 | var routes = require('./routes') |
31 | var api = require('./routes/api') | 34 | var api = require('./routes/api/' + global.API_VERSION) |
32 | var utils = require('./src/utils') | 35 | var utils = require('./src/utils') |
33 | var videos = require('./src/videos') | 36 | var videos = require('./src/videos') |
34 | var webtorrent = require('./src/webTorrentNode') | 37 | var webtorrent = require('./src/webTorrentNode') |
@@ -88,9 +91,10 @@ | |||
88 | } | 91 | } |
89 | 92 | ||
90 | // ----------- Routes ----------- | 93 | // ----------- Routes ----------- |
91 | app.use('/api/videos', api.videos) | 94 | var api_route = '/api/' + global.API_VERSION |
92 | app.use('/api/remotevideos', api.remoteVideos) | 95 | app.use(api_route + '/videos', api.videos) |
93 | app.use('/api/pods', api.pods) | 96 | app.use(api_route + '/remotevideos', api.remoteVideos) |
97 | app.use(api_route + '/pods', api.pods) | ||
94 | 98 | ||
95 | // ----------- Tracker ----------- | 99 | // ----------- Tracker ----------- |
96 | 100 | ||