connectors
v1.0.0
Published
Nodejs Database connectors
Downloads
41
Readme
Database Connectors
Nodejs unify database connectors
How to
npm install connectors
// define array of connection info
let database = [
{
connector_name: 'mongoose',
host: '127.0.0.1',
port: '27017',
db_name: 'db_test'
}
];
// require somewhere globally during application start/setup/init
require('connectors').init(database);
// and use like that in your model:
const {mongoose} = require('connectors');
// or
db.rabbitmq.sendToQueue('queue_name', new Buffer('something...'))
Settings Configuration Example
const settings = [
{
connector_name: 'mongoose',
host: 'localhost',
port: '',
db_name: ''
},
{
connector_name: 'mysql',
host: 'localhost',
port: '',
db_name: ''
}
];
TODO:
- support multi connection at the same db.
- connect all configured db at once(async).
- consider if i need mysql + redis export in index.js
- mongoose promise is dep: "(node:11663) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html"