0
我想与OrientDB一起使用SailsJS(使用Oriento作为NodeJS)。建立和定义数据库连接以便在每个模型中都可用的地方是什么地方?SailsJS:在哪里定义数据库连接到不支持的数据库类型(orientdb)?定制中间件?
我将config/connections.js中的连接值和/config/http.js中的连接值作为自定义中间件。它的工作原理,但我绝对不知道这是正确的
module.exports.http = {
middleware: {
custom: true
},
customMiddleware: function(app){
var Oriento = require('oriento');
var Oserver = Oriento({
host: sails.config.connections.orientDBServer.host,
port: sails.config.connections.orientDBServer.port,
username: sails.config.connections.orientDBServer.username,
password: sails.config.connections.orientDBServer.password
});
db = Oserver.use({
name: sails.config.connections.orientDBServer.dbname,
username: sails.config.connections.orientDBServer.username,
password: sails.config.connections.orientDBServer.password
});
}
}
我已经看到了,但我认为这是在早期阶段。仔细观察它也依赖于Oriento。所以我只是分叉它,并将在为适配器做出贡献的方式上添加必要的改进。 – 2014-12-11 17:44:05