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