README
hapi-base
Quick Start
Make a new repo for your server, and add hapi-base
as a dependency.
Create a config file:
// config.js
var MyPlugin = require('my-plugin')
module.exports = {
partitions: [
{
domains: ['necrotizing-pineapple.com']
, plugins: [MyPlugin]
}
]
}
Create an index file:
// index.js
var startCluster = require('hapi-base').startCluster
, require('./config.js')
startCluster(config)
Configuration Options
config.partitions
The most important configuration option, this is an array of partitions.
A partition looks like this:
{
domains: ['necrotizing-pineapple.com']
, plugins: [MyPlugin]
}
This says "handle connections that come from these domains with these plugins". We do it this way to keep route configuration separate from the hapi-base
repo.
Internally, labels are derived from the domains and used to route the connections to the right place.