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 FluxApplication();
var pluginInstance = routrPlugin({
routes: {
user: {
path: '/user/:id',
method: 'get',
action: function (actionContext, payload, done) {
done();
}
}
}
});
app.plug(pluginInstance);
Fluxible Methods Added
actionContext
Provides full access to the routr instance. See [https://github.com/yahoo/routr](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 factory
License
This software is free to use under the Yahoo! Inc. BSD license.
See the LICENSE file for license text and copyright information.