yahoi
Version:
Yet Another Highly Opinionated Isomorphic Framework
44 lines (32 loc) • 7.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _yahoi = require('yahoi');
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 DefaultRouter = function (_Router) {
_inherits(DefaultRouter, _Router);
function DefaultRouter(props) {
_classCallCheck(this, DefaultRouter);
var _this = _possibleConstructorReturn(this, (DefaultRouter.__proto__ || Object.getPrototypeOf(DefaultRouter)).call(this, props));
_this.addRoute({ path: '/', controller: 'Index', action: 'Index' });
_this.addRoute({ path: '/examples', router: 'Example' });
return _this;
}
return DefaultRouter;
}(_yahoi.Router);
exports.default = DefaultRouter;