samedi 4 avril 2015

how do i handle every route possible with a react router at the server?

Following the readme in the react-router:



var routes = (
<Route name="app" path="/" handler={App}>
<Route name="inbox" handler={Inbox}/>
<Route name="calendar" handler={Calendar}/>
<DefaultRoute handler={Dashboard}/>
</Route>
);

Router.run(routes, function (Handler) {
React.render(<Handler/>, document.body);
});


Being extremely fresh to node and a reputable front end js framework please excuse the noobish question..


How is it best to handle the routes at the server?


I mean, what happens when someone lands on /calendar, do i have to accommodate for the route at the client in the react code and at the server in express routes, or should there be a wildcard route at express. IE someone lands on /calendar, should express deliever the html for / and allow react to handle the rest?


Thanks, John


Aucun commentaire:

Enregistrer un commentaire