Skip to content
Guy Paterson-Jones edited this page Feb 9, 2015 · 2 revisions

routes.js is the routing configuration file. Currently this is required by zygo - a 'CGI' mode based on directory structure is planned for the future. The structure is as follows:

export default {
  "component": "../components/module.jsx!",

  "/subroute": {
    "component": "some/path/to/module.jsx!",
  },

  "/:sugar/for/the/above": "./sugar/module.jsx!"
}

Components for a subroute are optional. If no component is given, an empty wrapper component will be rendered instead.

Component paths must be given as JSPM paths. These can be relative paths, or absolute module paths.

Routes are matched from the shallowest to the deepest route. Rendering then occurs backwards - the deepest route is rendered first, then passed as a child to the next deepest route, all the way back up to the root component. This allows you to specify, for instance, a root page component wrapping all other routes.

Clone this wiki locally