2019-02-04 12:01:36 -06:00
|
|
|
/**
|
|
|
|
* Media Proxy
|
|
|
|
*/
|
|
|
|
|
|
|
|
import * as Koa from 'koa';
|
|
|
|
import * as cors from '@koa/cors';
|
2019-09-26 15:50:34 -05:00
|
|
|
import * as Router from '@koa/router';
|
2019-02-04 12:01:36 -06:00
|
|
|
import { proxyMedia } from './proxy-media';
|
|
|
|
|
|
|
|
// Init app
|
|
|
|
const app = new Koa();
|
|
|
|
app.use(cors());
|
|
|
|
|
|
|
|
// Init router
|
|
|
|
const router = new Router();
|
|
|
|
|
|
|
|
router.get('/:url*', proxyMedia);
|
|
|
|
|
|
|
|
// Register router
|
|
|
|
app.use(router.routes());
|
|
|
|
|
|
|
|
module.exports = app;
|