Try api design, orz

master
Dario Ernst 10 years ago
parent 07c540fc8f
commit 275df5e051

@ -20,18 +20,27 @@ server.get(/\/client\/?.*/, restify.serveStatic({
// Mockup Methods // Mockup Methods
server.get('/seek/:time', function (req, res, next) { // /seek/:time — seeks relative
log.info("Seeking "+req.params['time']+" now."); // /seek/:time/:mode — seeks with mode, modes [relative|absolute|absolute-percent|relative-percent|exact|keyframes]
return FS.write( fifoPath, '{ "command": ["seek", "10"] }\n' ) // /seek-chapter/:where — seeks to prev (where=-x) or next (where=+x) chapter
.then(function () { // /volume/:amount — increases (amount=+x) or decreases (amount=-x) volume
log.info("wrote seek 10 to "+fifoPath); // /progress — show osd progress
res.send({'success':true}); // /playpause — toggles playing
return next(false); // /muteunmute — toggles muting
}, function(reason) {
log.info("failed because "+reason); // server.get('/seek/:time', function (req, res, next) {
}); // log.info("Seeking "+req.params['time']+" now.");
log.info("after then"); // return FS.write( fifoPath, '{ "command": ["seek", "10"] }\n' )
}); // .then(function () {
// log.info("wrote seek 10 to "+fifoPath);
// res.send({'success':true});
// return next(false);
// }, function(reason) {
// log.info("failed because "+reason);
// });
// log.info("after then");
// });
server.get('/seek/:time/:mode', function (req, res, next) { server.get('/seek/:time/:mode', function (req, res, next) {
log.info("Seeking "+req.params['time']+" with mode "+req.params['mode']+" now."); log.info("Seeking "+req.params['time']+" with mode "+req.params['mode']+" now.");
res.send({'success':true}); res.send({'success':true});

Loading…
Cancel
Save