0
How to import model/Connection.js files to model/Tables.js
model/Connection.js
const Sequelize = require('sequelize');
const sequelize = new Sequelize('caoperdido', 'root', '', {
host: 'localhost',
dialect: 'mysql'
});
sequelize.authenticate().then(() => {
console.log('Connection has been established successfully.');
}).catch(err => {
console.error('Unable to connect to the database:', err);
});
model/Tables.js
const User = sequelize.define('user', {
// attributes
firstName: {
type: Sequelize.STRING,
allowNull: false
},
lastName: {
type: Sequelize.STRING
// allowNull defaults to true
}
});
User.sync({ force: true }).then(() => {
return User.create({
firstName: 'Diovane',
lastName: 'Maia'
});
});
Where are the images
menino.png
andmenina.png
on your computer? Since you are not giving a relative path to these images, the browser will search for them at the root of your computer/server. If the images are in the same folder as your html, you could access them as the path./menino.png
. If they were inside a directory, it would be something like./imgs/menino.png
. If they are in a directory above html,../menino.png
. Locate the images and give the appropriate path to access them.– Andre