NOTICE: Since light is a work in progress, breaking changes will be made every MINOR patch until 2.0

server

a function to generate a http server and router

server({ routes, log }): object

server is a function used to take in a path to a set of routes, 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,
  log,
}

routes: string[] | string

An array of strings or a string containing paths to folders or single files. You may mix and match files and folders.

log: boolean

A boolean to toggle logging to the console.