January 2019
Intermediate to advanced
460 pages
10h 33m
English
We will use the Sequelize CLI to generate our first database model. Install it globally with the following command:
npm install -g sequelize-cli
This gives you the ability to run the sequelize command inside of your Terminal.
The Sequelize CLI allows us to generate the model automatically. This can be done by running the following command:
sequelize model:generate --models-path src/server/models --migrations-path src/server/migrations --name Post --attributes text:text
Sequelize expects us to run the command in the folder in which we have run sequelize init, by default. Our file structure is a bit different, because we have two layers with src/server. For this reason, we specify the path manually, with the first ...
Read now
Unlock full access