A hapi plugin integrating Waterline ORM, currently at v2.3.0. It allows defining models, adapters, and connections for Waterline within a hapi server, and provides convenience methods like `server.dogwater()`, `server.collections()`, and `request.collections()` to access Waterline collections. Supports multi-plugin deployments with collision protection. Works with hapi >=10 <17 and waterline >=0.10.0 <0.13.0. Last updated in 2019; no major releases since v2. Alternative to using Waterline standalone with hapi.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Package is CJS-only; ESM import will fail. Use require.
const Dogwater = require('dogwater')
Accepts a single config object, not separate arguments.
server.dogwater({ identity: 'model', connection: 'conn', attributes: {} })
request.collections() is a method that returns an object. Call it each time.
const Cols = request.collections(); const Model = Cols.modelname
server.collections is a function; must be invoked.
const Cols = server.collections(); const Model = Cols.modelname
Shows full hapi server setup with Dogwater, including model definition, route using request.collections(), and startup with data creation.
const Hapi = require('hapi');
const Dogwater = require('dogwater');
const Memory = require('sails-memory');
const server = new Hapi.Server();
server.connection({ port: 3000 });
server.route({
method: 'get',
path: '/dogs/{id}',
handler: function (request, reply) {
const Dogs = request.collections().dogs;
reply(Dogs.findOne(request.params.id));
}
});
server.register({
register: Dogwater,
options: {
adapters: { memory: Memory },
connections: { simple: { adapter: 'memory' } }
}
}, (err) => {
if (err) throw err;
server.dogwater({
identity: 'dogs',
connection: 'simple',
attributes: { name: 'string' }
});
server.start((err) => {
if (err) throw err;
const Dogs = server.collections().dogs;
Dogs.create([
{ name: 'Guinness' },
{ name: 'Sully' },
{ name: 'Ren' }
]).then(() => {
console.log(`Go find some dogs at ${server.info.uri}`);
}).catch((err) => console.error(err));
});
});
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.