server({ routes, opts }): object

server is a function used to take in a path to a set of routes or the code to the routes themselves, generate the router, and return a http server and the respective router object (generated by find-my-way).

Output

This function returns an object.

{
  router,
  server,
}

router: object

A find-my-way router object.

server: Server

A HTTP server object which handles all of the routes provided by the routes parameter.

Parameters

This function take an object with a routes and log property.

{
  routes,
  opts,
}

routes: string | Route[]

A string or an array of routes containing the path to folders or the code itself.

opts: object

A hash of options to be sent to the Route class.

Last updated