0.3.0 • Published 9 years ago

fluxible-plugin-routr v0.3.0

Weekly downloads
1
License
-
Repository
-
Last release
9 years ago

Routr Plugin for Fluxible App

npm version Build Status Dependency Status devDependency Status Coverage Status

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 params
  • actionContext.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.

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago