# composeRoutes

## Arguments

| Name       | Type        | Description                                       |
| ---------- | ----------- | ------------------------------------------------- |
| opts       | Object      | The options object to apply to the octoris server |
| routes     | Map\[]      | The routing tree built out by the route functions |
| middleware | Function\[] | An array of middleware functions                  |

{% hint style="info" %}
Middleware run at this level is considered global middleware, meaning it will be ran before ANY route is called on.
{% endhint %}

## Options

```javascript
{
  logger: false
}
```

## Usage

```javascript
const { router, methods, response } = require('octoris')

function homeHandler () {
  return response.send(200, 'Hello Home!')
}

function aboutHandler () {
  return response.send(200, 'Hello About!')
}

const home = router.route([router.fixed('/')], [
  methods.GET(homeHandler)
])

const about = router.route([router.fixed('about')], [
  methods.GET(aboutHandler)
])

const routes = router.composeRoutes({ logger: true }, [about, home])
```
