# Routing for the REST API

Of course we need some endpoints for our server-side services.
Every module can register it's own API endpoints.
If an API endpoint is already in use, an exception will be thrown.
The ```apiRouter``` in the registry is simply an ```express.Router()``` instance,
so for more information please check out the [Express documentation](http://expressjs.com/en/guide/routing.html).

## Usage

To register a new API endpoint in a module, simply do the following:

```javascript
const registry = require('core/server/registry');
const apiRouter = registry.get('apiRouter');

apiRouter.get('/foo-bar', (req, res) => {
    res.send('Lorem ipsum dolor sit amet.');
});
```
