The request object is intended to be passed to the loaders with the current context. As a naive example demonstrates below.
var router = fluxapp.getRouter();
var context = fluxapp.createContext();
fluxapp.registerRoute({
id : 'user-homepace',
path : '/users/:id',
handler: require('./components/users/homepage'),
method : 'GET'
});
var request = router.build('homepage', {
params: {
id: 1
}
});
var route = router.getRoute(request.routeId);
route.loader(request, context).then(render);
This table outlines the request objects properties
Name | Type | Description |
---|---|---|
path | String | The path taken from node's internal url#parse method. |
pathname | String | The path name taken from node's internal url#parse method. |
query | Object | An object containing any query parameters |
url | String | The generated path consisting parameters, query and hash. |
hash | String | The hash taken from node's internal url#parse method. |
params | Object | An object containing the parameters passed in meta data on generation. |
routeId | String | The route that was matched and generated the request object. |
On to Route Loaders