I have created a Model named 'Product' and the below code in there
const Sequelize = require('sequelize');
const sequelize = require('../util/database');
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: true
},
description: {
type: Sequelize.STRING,
allowNull: true
}
});
exports.module = Product;
I am getting the below error
Product.create is not a function
If I replace exports.module = Product;
with module.exports = Product;
, It is working good.
Can anyone clarify what is the difference between the two