Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMuaaz Matwadia
Full Stack JavaScript Techdegree Graduate 19,327 PointsSequelize Define a model
const sequelize = new Sequelize({...});
Im getting an error whenever I type the " ... ".Also what does the dots do?
Here is my full code:
const Sequelize = require('sequelize');
const sequelize = new Sequelize({...});
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: 'movies.db',
});
(async () => {
try {
await sequelize.authenticate();
console.log('Connection to the database successful!');
} catch (error) {
console.error('Error connecting to the database: ', error);
}
})();
class Movie extends Sequelize.Model {}
Movie.init({ ... });
(async () => {
await sequelize.sync({ force: true });
try {
const movie = await Movie.create({
title: 'Toy Story',
});
console.log(movie.toJSON());
} catch (error) {
console.error('Error connecting to the database: ', error);
}
})();```
Muaaz Matwadia
Full Stack JavaScript Techdegree Graduate 19,327 PointsHey, Reggie Williams it says unexpected token by the last curly bracket on line 2
1 Answer
Karol Chabros
17,675 PointsThese dots represents folded or collapsed code from previous step. sequelize should look like this:
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: 'movies.db'
});
Johannes Karpe
6,899 Pointsthank you for this! I though I only had to created this once. I deleted it after the first step!
Reggie Williams
Treehouse TeacherReggie Williams
Treehouse TeacherHey Azzie Fuzzie the
...
are just placeholders for values you'll update later. Which line are you getting the error on?