The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

easante (110) [Avatar] Offline
#1
Chapter 6 makes reference to sendJsonResponse supposedly defined in an earlier chapter, but there is no such definition prior to its use.
Joerg Jooss (9) [Avatar] Offline
#2
I've noticed this too. That's a leftover from the 1st edition:

var sendJsonResponse = function(res, status, content) {
  res.status(status);
  res.json(content);
};


IMHO it would be much more useful if Express came with

res.ok(content)
or
res.notFound()
etc. out-of-the-box.
simon.holmes (148) [Avatar] Offline
#3
Whoops!

Thanks for spotting that! Yeah, that was left over from the first edition, but I decided not to keep it.

I'll look for it in Chapter 6 and replace it with the standard
res.status().json()
approach - the code in GitHub will be correct.

Thanks!
Simon