Use this repo to practice writing RESTful CRUD routes. Simulate client interactions using Postman Postman. The goal of this mini challenge is to make all tests pass and practice error handling in an express server. See requirements section below for challenge details.
To get started:
Navigate to the project Directory
$ cd BackEndMiniChallengeInstall the dependencies
$ npm installIn a new terminal, seed the database
$ mysql -u root -p < schema.sql;Start the server
$ npm run startBefore running the tests, create and use the test database
$ CREATE DATABASE pets_info_test;
$ USE pets_info_test;Run the tests
$ npm run testIn order to make the tests pass in this exercise, you'll need to complete both the server routes (server/index.js) and the database helper functions (databse/index.js).
| METHOD | PATH | DESCRIPTION |
|---|---|---|
| GET | /api/pets | respond with all the pets |
| GET | /api/pets/:id | respond with single pet, based on req.params.id |
| POST | /api/pets | inserts new pet record from req.body |
| PUT | /api/pets/:id | updates a pet record from req.body |
| PATCH | /api/pets/:id | updates specific section of a pet record from req.body |
| DELETE | /api/pets/:id | deletes a pet record based on req.params.id |
| Express | MySQL | Jest | Supertest |