# Routing

There are two type of routing in this architecture: server-side routing and client-side routing.
To make our life easier, server-side routing only means the REST API.
For every other routing we are using the [React Router](https://github.com/reactjs/react-router).

## Server-side routing

As mentioned before, this only means the REST API. [More info here](API-Router.md)

## Client-side routing

Every routing information can be found in the ```routes.js``` file. It is in pure Javascript, and
we are using [React Router](https://github.com/reactjs/react-router) for routing.
```
+-- config/
    +-- routes.js
```

## But wait, don't we need the routing information on the server-side?

Fortunately not. These informations are only important for the server-side rendering to be able
to load the required data for rendering the views. However, this is solved under the hood.
If you would like to learn more about it, see it under [Server Side Rendering](Server-Side-Rendering.md).


## Adding new routes

Adding new routes is very easy, just import your React component in the ```routes.js``` file, and
create a new <Route /> element with it.

```javascript
import React from 'react';
import { Route } from 'react-router';

// Import your container components from the modules
// and wire them together here
import App from '../modules/app/client/App';
import Todos from '../modules/todos/client/Todos';

// This means we will only have two routes: "/" and "/todos"
export default (
    <Route path="/" component={App}>
        <Route path="todos" component={Todos} />
    </Route>
);
```
