Grokking ExpressJS
Vote

0% completed

​

CRUD Operations with Sequelize

With the connection in db.js, the Book model in models/book.js, and a Books table that sync() creates at startup, the PostgreSQL bookstore is ready for its routes. They are the same five CRUD routes as in the MongoDB version, so you can compare the two libraries route by route. The routes use this model from the previous lesson, unchanged:

const { DataTypes } = require('sequelize'); const sequelize = require('../db'); const Book = sequelize.define('Book', { title: { type: DataTypes.STRING, allowNull: false }, author: { type: DataTypes

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content