A mySQL review repo for practicing connecting a MySQL database to an Express server
npm install
npm run connect
verify db connection
npm start
start express server
This repo is recommended to be used with MySQL 8.0
-
Create database
ShopDBwithin MySQL -
Establish connection to database in
database/index.js
-
Create a schema in
database/schema.sqlto describe ourinventorytable -
Run schema file in terminal
-
Create a seeding function in
database/seed.jsto populate table with at least 5 records -
Run seed file in terminal
- Create dbHelper functions in
database/dbHelpers.js
-
Implement the following CRUD functionality:
Create new recordRead all recordsRead one record by idUpdate one recordDelete one record
-
Create controller functions in
server/controllers.js -
Create routes in
server/router.js -
Use dbHelper functions within your controller functions
- Test for working functionality via Postman
Diagram courtesy of Jordan Chun
