A micro plugin that use rethinkdb-init to create databases, tables and indexes when your hapi server starts.
npm install --save hapi-rethinkdb-init
var Hapi = require('hapi');
var server = new Hapi.Server();
var options = {
tables: [
{
name: 'person',
indexes: ['firstName', 'lastName']
},
'address'
]
};
server.register(require('hapi-rethinkdb'), function (err) {
server.register({register: require('hapi-rethinkdb-init'), options: options}, function (err) {
// Table person with firstName and lastName indexes created
// Table address created
});
});
tables
- the array of tables expected byrethinkdb-init
. Please refer to the rethinkdb-init documentation.
Package | Version | Dev |
---|---|---|
joi | ^7.0.1 | ✖ |
rethinkdb | ^2.2.0 | ✖ |
rethinkdb-init | 0.0.5 | ✖ |
babel-cli | ^6.2.0 | ✔ |
babel-core | ^6.2.1 | ✔ |
babel-preset-es2015 | ^6.1.18 | ✔ |
code | ^2.0.1 | ✔ |
hapi | ^11.1.2 | ✔ |
hapi-rethinkdb | ^2.0.1 | ✔ |
lab | ^7.3.0 | ✔ |
node-readme | ^0.1.9 | ✔ |
rethinkdb | ^2.2.0 | ✔ |
g-div