listen

listen is the main function you use to start your server with octoris

Listen takes in all the options that the http module server.listen accepts you can check those here

The only required Option to give listen is the port option

Arguments

Name

Type

Description

options

Object

routes

Function

A function containing all the routes, this function is created by using composeRoutes

Returns

Type

Description

Promise

A promise object

Usage

const { listen } = require('octoris')

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

Last updated