Software Engineer · Teacher · Author · Vegan

Sequelize ORM

Create the following endpoint in your Express application using the Sequelize ORM. Test out your endpoint using Postman.

PATCH /tracks/:id

This endpoint should update a track by the id parameter. This endpoint should have the following validations:

If the update passes validation, respond with a 200 status code and the updated track in the response body.

If the update fails validation, return a JSON response in the following format, where each object contains the attribute that failed validation and a user friendly error message.

  "errors": [
      "attribute": "name",
      "message": "..."

If the track isn’t found, return an empty response with a 404 status code.

For your Track model, alias the column names to their camelCased version. For example, the column UnitPrice should be unitPrice on your model. Also, alias your primary key TrackId to just id.