Flow Router Map
Provides a nice routing API for FlowRouter. Inspired by Django urls flow-router-map is designed to keep all of your url paths in the one place so you gain a clear visual overview of your entire application's routes. See the example below.
Installation
$ meteor add dburles:flow-router-map
API
route(path, options, [group])
Example
1FlowRouter.map(route => { 2 // Base 3 route('/', Routes.home); 4 route('/about', Routes.about); 5 route('/contact', Routes.contact); 6 7 // Products 8 route('/', Routes.products.home, RouteGroups.products); 9 route('/view/:slug', Routes.products.view, RouteGroups.products); 10 route('/category/:slug', Routes.products.category, RouteGroups.products); 11 12 // Admin 13 route('/', Routes.admin.home, RouteGroups.admin); 14 // ... etc 15});
Basic Usage
1Routes = { 2 home: { 3 name: 'home', 4 action() { 5 // ... 6 } 7 } 8}; 9 10FlowRouter.map(route => { 11 route('/', Routes.home); 12});
Route Groups
flow-router-map works well with Flow Router route groups.
1Routes = { 2 home: { 3 name: 'home', 4 action() { 5 // ... 6 } 7 }, 8 admin: { 9 home: { 10 name: 'adminHome', 11 action() { 12 // ... 13 } 14 } 15 } 16}; 17 18RouteGroups = { 19 admin: FlowRouter.group({ 20 prefix: '/admin' 21 }) 22}; 23 24FlowRouter.map(route => { 25 route('/', Routes.home); 26 route('/', Routes.admin.home, RouteGroups.admin); 27});
License
MIT