API changes, add documentation
This commit is contained in:
parent
7b5476874d
commit
21c3a1b3cd
6 changed files with 124 additions and 32 deletions
|
|
@ -2,6 +2,7 @@ import IOConfiguration from '../../configuration/ioconfig';
|
|||
import NullClusterClient from '../../io/cluster/nullclusterclient';
|
||||
import Config from '../../config';
|
||||
import CyTubeUtil from '../../utilities';
|
||||
import Logger from '../../logger';
|
||||
|
||||
export default function initialize(app) {
|
||||
const ioConfig = IOConfiguration.fromOldConfig(Config);
|
||||
|
|
@ -9,13 +10,18 @@ export default function initialize(app) {
|
|||
|
||||
app.get('/socketconfig/:channel.json', (req, res) => {
|
||||
if (!req.params.channel || !CyTubeUtil.isValidChannelName(req.params.channel)) {
|
||||
return res.status(400).json({
|
||||
return res.status(404).json({
|
||||
error: `Channel "${req.params.channel}" does not exist.`
|
||||
});
|
||||
}
|
||||
|
||||
clusterClient.getSocketConfig(req.params.channel).then(config => {
|
||||
res.json(config);
|
||||
}).catch(err => {
|
||||
Logger.errlog.log(err.stack);
|
||||
return res.status(500).json({
|
||||
error: err.message
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue