fix(options): take a name
parameter, same as the name
parameter used in hapi-sequelize
, fixes #8
This commit is contained in:
parent
fb06d9cd27
commit
d142e6c553
@ -28,6 +28,7 @@ await register({
|
||||
register: require('hapi-sequelize-crud'),
|
||||
options: {
|
||||
prefix: '/v1',
|
||||
name: 'db', // the same name you used for configuring `hapi-sequelize` (options.name)
|
||||
defaultConfig: { ... } // passed as `config` to all routes created
|
||||
}
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hapi-sequelize-crud",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"description": "Hapi plugin that automatically generates RESTful API for CRUD",
|
||||
"main": "build/index.js",
|
||||
"config": {
|
||||
|
@ -9,7 +9,8 @@ import qs from 'qs';
|
||||
const register = (server, options = {}, next) => {
|
||||
options.prefix = options.prefix || '';
|
||||
|
||||
const db = server.plugins['hapi-sequelize'].db;
|
||||
const name = options.name || 'db';
|
||||
const db = server.plugins['hapi-sequelize'][name];
|
||||
const models = db.sequelize.models;
|
||||
|
||||
const onRequest = function (request, reply) {
|
||||
|
Loading…
Reference in New Issue
Block a user