我想如果有办法使用一个Firebase实时数据库与Sequelize的API。
在sequelize.js中,我的API是用本地mariadb设置的:
const Sequelize = require('sequelize');
module.exports = function (app) {
const sequelize = new Sequelize(
'dbName',
'username',
'password',
{
host: 'mariadb',
dialect: 'mysql'
}
);
const oldSetup = app.setup;
app.set('sequelizeClient', sequelize);
app.setup = function (...args) {
const result = oldSetup.apply(this, args);
// Set up data relationships
const models = sequelize.models;
Object.keys(models).forEach(name => {
if ('associate' in models[name]) {
models[name].associate(models);
}
});
// Sync to the database
app.set('sequelizeSync', sequelize.sync());
return result;
};
};
我需要这里的一切尤其是人际关系。
所以我可以使用实时数据库/firestore数据库与羽毛JS续集?
- 我尝试使用firstore-sequelize包,但API无法启动,并得到以下信息:
/node_modules/feathers-sequelize/lib/index.js:31
2022-12-08 12:15:50 Sequelize = options.Model.sequelize.Sequelize;
2022-12-08 12:15:50 ^
2022-12-08 12:15:50
2022-12-08 12:15:50 TypeError: Cannot read properties of undefined (reading 'Sequelize')
我从实时数据库中得到的唯一东西是databaseURL,或者也许我应该使用SDK?
1条答案
按热度按时间whhtz7ly1#
也许可以尝试将代码编辑为:
至于身份验证/凭据read,这是第一次,因为谷歌必须识别你,并允许访问。