Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Using Sequelize ORM With Express !

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Sequelize allows you to extend models with additional functionality. Since Sequelize models are ES6 classes, you can easily add custom instance-level methods that encapsulate the functionality. In this video, you'll create helper methods to format an article's publish date and short description.
Code Snippets
publishedAt() {
const date = moment(this.createdAt).format("MMMM D, YYYY, h:mma");
return date;
}
shortDescription() {
const shortDesc = this.body.length > 200 ? this.body.substring(0, 200) + "..." : this.body;
return shortDesc;
}
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Liz Novaski
Full Stack JavaScript Techdegree Graduate 15,762 Points3 Answers
-
Jivansh Bakshi
2,564 Points5 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up