UNPKG

yahoi

Version:

Yet Another Highly Opinionated Isomorphic Framework

51 lines (36 loc) 7.73 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _Router2 = require('./../lib/Router'); var _Router3 = _interopRequireDefault(_Router2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* * * Default Router * ################################################################### * * This router is mandatory and the default entry point for all routes * for your appliation * * Yahoi uses the following route-parser for 'path': * https://www.npmjs.com/package/route-parser * */ var TranslationRouter = function (_Router) { _inherits(TranslationRouter, _Router); function TranslationRouter(props) { _classCallCheck(this, TranslationRouter); var _this = _possibleConstructorReturn(this, (TranslationRouter.__proto__ || Object.getPrototypeOf(TranslationRouter)).call(this, props)); // props. _this.addRoute({ path: '/get', controller: 'DefaultTranslation', action: 'get' }); _this.addRoute({ path: '/add', controller: 'DefaultTranslation', action: 'add' }); // this.addRoute({ path: '/:language/documentation/:version', router: 'Documentation' }); return _this; } return TranslationRouter; }(_Router3.default); exports.default = TranslationRouter;