Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dburles/meteor-flow-router-map
Meteor package for Flow Router
https://github.com/dburles/meteor-flow-router-map
meteor meteor-package
Last synced: 3 months ago
JSON representation
Meteor package for Flow Router
- Host: GitHub
- URL: https://github.com/dburles/meteor-flow-router-map
- Owner: dburles
- License: mit
- Created: 2015-10-06T03:59:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-09T01:42:49.000Z (about 9 years ago)
- Last Synced: 2023-05-09T13:36:48.376Z (over 1 year ago)
- Topics: meteor, meteor-package
- Language: JavaScript
- Homepage: https://atmospherejs.com/dburles/flow-router-map
- Size: 145 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Flow Router Map
Provides a nice routing API for FlowRouter. Inspired by [Django urls](https://docs.djangoproject.com/en/1.8/topics/http/urls/#example) 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
```sh
$ meteor add dburles:flow-router-map
```## API
```
route(path, options, [group])
```## Example
```js
FlowRouter.map(route => {
// Base
route('/', Routes.home);
route('/about', Routes.about);
route('/contact', Routes.contact);// Products
route('/', Routes.products.home, RouteGroups.products);
route('/view/:slug', Routes.products.view, RouteGroups.products);
route('/category/:slug', Routes.products.category, RouteGroups.products);// Admin
route('/', Routes.admin.home, RouteGroups.admin);
// ... etc
});
```## Basic Usage
```js
Routes = {
home: {
name: 'home',
action() {
// ...
}
}
};FlowRouter.map(route => {
route('/', Routes.home);
});
```## Route Groups
flow-router-map works well with Flow Router route groups.
```js
Routes = {
home: {
name: 'home',
action() {
// ...
}
},
admin: {
home: {
name: 'adminHome',
action() {
// ...
}
}
}
};RouteGroups = {
admin: FlowRouter.group({
prefix: '/admin'
})
};FlowRouter.map(route => {
route('/', Routes.home);
route('/', Routes.admin.home, RouteGroups.admin);
});
```### License
MIT