In this long practice, you will be adding Sequelize to an Express server, creating a model, and seeding the database.
Download the starter. cd
into server folder, and install dependencies
using npm install
.
Create a server/.env file in order to store environment variables. Add a
variable DB_FILE
with a value of db/dev.db
. This will be the location where
the SQLITE database will be created (as specified in
config/database.js).
To save you some time, the starter includes server/.sequelizerc, server/config/database.js, and server/db/ with migrations, models, and seeders. This means Sequelize has already been initialized.
Run the migration using the appropriate sequelize
command. This should create
the (empty) database. If successful, it will end with
No migrations were executed, database schema was already up to date.
and you
should now see that the db/dev.db file was created.
Remember: You'll need
dotenv
beforenpx
in order to set the environment variable for the database file location.
If you encounter any errors or do not see the db file, go back and check that your .env file has been accurately set up. Then rerun the migration.
This project has been broken down into phases. Complete as much as you can in the time allotted. You can complete any remaining work for additional practice during assessment prep.
If you get stuck, you can formulate good questions, and reach out to your instructors for assistance.
You may refer to your previous work, the Sequelize documentation, the documentation for Sequelize CLI, or online resources to assist you in completing this practice.