To store owner, dog and class information in a database, created in MySQL, then use Express to create queries.
- Build a database in MySQL
- Create tables to store owner, dog and class information
- Create an additional pivot table to connect them together
- Build API endpoints using MySQL and Express
- show a list of classes
- show a specific class using classID
- show a specific class using classID and the dogs taking that class
- show a list of dogs
- show a specific dog using dogID
- show a specific dog using dogID and the classes the dog is taking
- Test endpoints using Postman
- Set up a migration file
Link to DB Designer: https://app.dbdesigner.net/designer/schema/274995
URI | HTTP Method | Description | Req Object | Res Object |
---|---|---|---|---|
/classes | GET | Get all data from classes | none | INT |
/classes/:classID | GET | Get list of specific class | none | INT |
/dog_classes/:classID/:dogID | GET | Get list of dogs taking specific class | none | INT |
/dogs | GET | Get all data from dogs | none | INT |
/dogs/:dogID | GET | Get list of specific dog | none | INT |
/dog_classes/:dogID/:classID | GET | Get class list for specific dog | none | INT |
Please follow these steps to get setup:
- Run
yarn
on root folder to install dependencies related to Express.
- Create
.env
file in project directory and add
DB_NAME=mindsalike
DB_PASS={a password of your choosing}
- Run
yarn migrate
in your TERMINAL. - This will create four tables in your database called:
- 'classes'
- 'dogs'
- 'owners'
- 'dog_classes'
- Run
yarn start
in project directory to start the Express
Port should start on Localhost:5000. - Test your API in
http://localhost:5000
This is a student project that was created at CodeOp, a full stack development bootcamp in Barcelona.