# listen

{% hint style="info" %}
Listen takes in all the options that the `http` module `server.listen` accepts you can check those [here](https://nodejs.org/dist/latest-v12.x/docs/api/net.html#net_server_listen_options_callback)
{% endhint %}

{% hint style="warning" %}
The only required Option to give `listen` is the port option
{% endhint %}

## Arguments

| Name    | Type     | Description                                                                                                        |
| ------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
| options | Object   | [server.listen options](https://nodejs.org/dist/latest-v12.x/docs/api/net.html#net_server_listen_options_callback) |
| routes  | Function | A function containing all the routes, this function is created by using `composeRoutes`                            |

## Returns

| Type    | Description      |
| ------- | ---------------- |
| Promise | A promise object |

## Usage

```javascript
const { listen } = require('octoris')

listen({ port: 3000 }, routes)
  .then(addr => console.log(`Server Listening on ${addr}`))
  .catch(console.error)
  
```
