stremio-web/src/common/routesRegexp.js
2019-06-03 13:47:19 +03:00

22 lines
686 B
JavaScript

const PathToRegexp = require('path-to-regexp');
const compilePath = (path, options) => {
const keys = [];
const regexp = PathToRegexp(path, keys, { ...options });
return { keys, regexp };
};
const routesRegexp = {
intro: compilePath('/intro'),
board: compilePath('/'),
discover: compilePath('/discover(?:/(:type|)(?:/(:catalog|))?)?'),
library: compilePath('/library(?:/(:type|)(?:/(:sort|))?)?'),
calendar: compilePath('/calendar'),
search: compilePath('/search'),
detail: compilePath('/detail'),
addons: compilePath('/addons'),
settings: compilePath('/settings'),
player: compilePath('/player')
};
module.exports = routesRegexp;