Closed aszx87410 closed 8 years ago
@aszx87410 its not currently possible, but very easy to support. You'd just change this line: https://github.com/dchester/epilogue/blob/master/lib/index.js#L64 to optionally use options.sequelize
. PRs are welcomed, please include a test.
Answer: just pass different model from different database, no need to care about sequelize instance. example:
var db1 = new Sequelize('db1',null, null);
var db2 = new Sequelize('db2', null, null);
var User = db1.define('Test', {
username: Sequelize.STRING,
});
var User2 = db2.define('Test2', {
hello: Sequelize.STRING
});
var userResource = epilogue.resource({
model: User,
endpoints: ['/users', '/users/:id']
});
var userResource2 = epilogue.resource({
model: User2,
endpoints: ['/user2', '/user2/:id']
})
Hi, Is it possible if I want to use multiple Sequelize instance?
For example, I have DB-1 and DB-2, in order to connect both, I need 2 Sequelize instance. But it seems that epilogue not support this feature?
In my opinion, maybe
epilogue.resource
should also add sequelize as parameter? allow user use different Sequelize instance. likevar users = epilogue.resource({ model: User, sequelize: anotherDatabase, endpoints: ['/api/users', '/api/users/:id'] });