yahoi
Version:
Yet Another Highly Opinionated Isomorphic Framework
33 lines (24 loc) • 1.19 kB
JavaScript
/*
*
* Example Router
* ###################################################################
*
* Yahoi uses the following route-parser for 'path':
* https://www.npmjs.com/package/route-parser
*
*/
import { Router } from 'yahoi';
export default class DefaultRouter extends Router {
constructor(props) {
super(props);
this.addRoute({ path: '', controller: 'Example', action: 'Index' });
this.addRoute({ path: '/render-string-1', controller: 'Example', action: 'RenderString1' });
this.addRoute({ path: '/render-string-2', controller: 'Example', action: 'RenderString2' });
this.addRoute({ path: '/render-json-1', controller: 'Example', action: 'RenderJson1' });
this.addRoute({ path: '/render-json-2', controller: 'Example', action: 'RenderJson2' });
this.addRoute({ path: '/render-view-1/:name', controller: 'Example', action: 'RenderView1' });
this.addRoute({ path: '/render-view-2/:name', controller: 'Example', action: 'RenderView2' });
this.addRoute({ path: '/redirect', controller: 'Example', action: 'Redirect' });
this.addRoute({ path: '/client', controller: 'Example', action: 'Client' });
}
}