July 2017
Intermediate to advanced
656 pages
16h 1m
English
After we create a hapi.Server instance (which we named server) we call the connection method. This will register the settings we pass in a list of connections.
When we later call server.start Hapi creates an http (or https if a tls object is supplied with key and cert buffer values). Unlike Express or Koa, Hapi allows for multiple connections, which in turn will create multiple core http server instances (with Express or Koa we would simply instantiate multiple instances of Express/Koa and reuse any routes/middleware between them as required).
In our case we call server.connection once, as a result, upon calling server.start, a single http server is created that listens to port 3000 (unless otherwise set in the PORT environment ...