A quick review of connecting a MySQL database to our Express server
npm install
npm run start
This repo is recommended to be used with MySQL 5.7.
- Create database
ReviewDBwithin MySQL - Establish connection to database in
database/index.js
- Create a schema in
database/schema.sqlto describe ourFastFoodtable - Run schema file in terminal
- Create a seeding function in
database/seed.jsto populate table with at least 5Things - Run seed file in terminal
- Create dbHelper functions in
database/dbHelpers.js - Create controller functions in
server/controllers.js - Use dbHelper functions within your controller functions
- Test for working functionality via Postman
Refactor the following files to utilize Sequelize ORM:
database/index.jsdatabase/dbHelpers.jsserver/controllers.js