Complete the code to import Sequelize from the package.
const { [1] } = require('sequelize');You need to import Sequelize with the exact name from the package to use it properly.
Complete the code to create a new Sequelize instance connecting to a SQLite database.
const sequelize = new Sequelize({ dialect: 'sqlite', storage: [1] });The storage option specifies the file name for the SQLite database. 'database.sqlite' is a common default.
Fix the error in the code to authenticate the Sequelize connection.
async function testConnection() {
try {
await sequelize.[1]();
console.log('Connection successful');
} catch (error) {
console.error('Connection failed:', error);
}
}The correct method to test the connection is authenticate(). Other options do not exist or are incorrect.
Fill both blanks to define a Sequelize model named 'User' with a string 'username' field.
const User = sequelize.[1]('User', { username: { type: DataTypes.[2], allowNull: false } });
Use define to create a model and DataTypes.STRING for a string field.
Fill all three blanks to sync the database and handle success or error.
sequelize.[1]() .then(() => { console.log('[2] synced successfully'); }) .catch(([3]) => { console.error('Sync failed:', [3]); });
sync() syncs the models to the database. The success message uses 'Database'. The error callback parameter is named 'error'.