0.3.0 • Published 11 years ago
fluxible-plugin-routr v0.3.0
Routr Plugin for Fluxible App
Provides routing methods to your Fluxible application using routr.
Usage
var FluxibleApp = require('fluxible-app');
var routrPlugin = require('fluxible-plugin-routr');
var app = new FluxibleApp();
var pluginInstance = routrPlugin({
routes: {
user: {
path: '/user/:id',
method: 'get',
// flux-router-component uses this action when the route is matched
action: function (actionContext, payload, done) {
// ...
done();
}
}
}
});
app.plug(pluginInstance);Fluxible Methods Added
actionContext
Provides full access to the routr instance. See routr docs for more information.
actionContext.routr.makePath(routeName, routeParams): Create a URL based on route name and paramsactionContext.routr.getRoute(path): Returns matched route
Other Methods
The plugin also provides access to some internals and the options that were passed in.
pluginInstance.getRoutes(); // returns the full routes object passed to factoryLicense
This software is free to use under the Yahoo! Inc. BSD license. See the LICENSE file for license text and copyright information.
