UNPKG

mediaproxy

Version:
41 lines (35 loc) 1.16 kB
// Generated by CoffeeScript 1.6.3 (function() { var MediaProxy, zappajs; MediaProxy = require('./MediaProxy'); zappajs = require('zappajs'); module.exports = function(config) { var service, _ref; service = (_ref = config.service) != null ? _ref : {}; service.disable_io = true; return zappajs(config.service, function() { var mediaproxy, server; mediaproxy = new MediaProxy(config.media); this.use('bodyParser'); this.put('/proxy/:uuid', function() { mediaproxy.add(this.req.params.uuid, this.req.body); return this.json(mediaproxy.get(this.req.params.uuid)); }); this.get('/proxy/:uuid', function() { return this.json(mediaproxy.get(this.req.params.uuid)); }); this["delete"]('/proxy/:uuid', function() { return this.json(mediaproxy.remove(this.req.params.uuid)); }); server = this.server; return this.post('/proxy/shutdown', function() { server.close(); mediaproxy.close(); return this.json({ ok: true }); }); }); }; module.exports.MediaProxy = MediaProxy; }).call(this);