スタートアップクライアントフォルダー内には、このようなroutes.jsファイルがあります。
import React from 'react';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import { Router, Route, browserHistory, IndexRoute } from 'react-router';
import { App } from '../../ui/App';
import { NavLayout } from '../../ui/layouts/NavLayout';
import { Index } from '../../ui/pages/Index';
import { TasksList } from '../../ui/pages/TasksList';
import { ReportsList } from '../../ui/pages/ReportsList';
import { TechniciansList } from '../../ui/pages/TechniciansList';
import { ChangePassword } from '../../ui/pages/ChangePassword';
const requireAuth = (nextState, replace) => {
if (!Meteor.loggingIn() && !Meteor.userId()) {
replace({
pathname: '/logout',
state: { nextPathname: nextState.location.pathname },
});
}
};
Meteor.startup(() => {
render(
<Router history={ browserHistory }>
<Route path="/" component={ App }>
<Route component={ NavLayout }>
<IndexRoute component={ Index } onEnter={ requireAuth } />
<Route path="/techniciens" component={ TechniciansList } onEnter={ requireAuth } />
<Route path="/techniciens/:id/edit" component={ EditTechnician } onEnter={ requireAuth } />
<Route path="/clients" component={ ClientsList } onEnter={ requireAuth } />
<Route path="/clients/:id" component={ ClientDetails } onEnter={ requireAuth } />
<Route path="/appareils" component={ MachinesList } onEnter={ requireAuth } />
<Route path="/appareils/:id" component={ MachineDetails } onEnter={ requireAuth } />
<Route path="/change-password" component={ ChangePassword } onEnter={ requireAuth } />
</Route>
<Route path="/logout" component={ Connexion } />
</Route>
</Router>,
document.getElementById('react-root')
);
});