In this step the controller function is created that calls the getArtist in the data layer and returns the response using REST:
- Open the controller file catalogueController.js, create a new function getArtist, and implement the logic to call the getArtist as part of the data layer and return the correct response. Please see a snapshot of the following code:
controller.getArtist = function (request, response) { data.getArtist(request.params.artistId, function(result){ var index; var albums; try{ //Loop through each album and songs to include //HAL and to capture the fields required in the JSON //response to the Client i.e. the MongoDB document //version field is not returned. for(index = 0; index ...