od vašeho product
model je v samostatném souboru, musíte jej importovat pomocí import
metoda dostupná v instanci sequelize takto
model product.js
module.exports = function(sequelize, Sequelize) {
const Product = sequelize.define('product', {
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
allowNull: false,
primaryKey: true
},
title: Sequelize.STRING,
price: {
type: Sequelize.DOUBLE,
allowNull: false
},
imageUrl: {
type: Sequelize.STRING,
allowNull: false
},
description: {
type: Sequelize.STRING,
allowNull: false
}
});
module.exports = Product;
};
dbconfig.js
const Sequelize = require('sequelize');
const sequelize = new Sequelize('node','root','1234567890', {
operatorsAliases: false ,
dialect: 'mysql',
host:'localhost'
});
sequelize.import('path/to/product/model');
module.exports = sequelize;
Reference sequelize import
Projekt Ukázka