Skip to content

Instantly share code, notes, and snippets.

@keremciu
Created October 18, 2016 12:03
Show Gist options
  • Save keremciu/ac271bce57f00bda0bc6fbfa1123f20b to your computer and use it in GitHub Desktop.
Save keremciu/ac271bce57f00bda0bc6fbfa1123f20b to your computer and use it in GitHub Desktop.
src/routes/index.js
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
/* eslint-disable global-require */
import Global from '../../components/Global/Global.js';
// The top-level (parent) route
export default {
path: '/',
// Keep in mind, routes are evaluated in order
children: [
require('./home').default,
require('./contact').default,
require('./login').default,
require('./register').default,
require('./admin').default,
// place new routes before...
require('./content').default,
require('./notFound').default,
],
async action({ next }) {
let route;
// Execute each child route until one of them return the result
// TODO: move this logic to the `next` function
do {
route = await next();
} while (!route);
// Provide default values for title, description etc.
route.title = `${route.title || 'Untitled Page'} - www.reactstarterkit.com`;
route.description = route.description || '';
route.global = Global;
return route;
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment