333912 (3) [Avatar] Offline
#1
Hi
here are some notes:

> Figure 7.7 A model for entries
This code doesn't not work until you add 'use strict'; at the top

> 'Before running the application, run touch views/menu.ejs ..'
It doesn't help much Windows users, as cmd.exe doesn't not have 'touch' command

> Figure 7.14 Validation middleware implementation
When i submit empty form i get this error
TypeError: res.error is not a function
at d:\shoutbox\middleware\validate.js:22:11
...
This is at line [res.error(`${field.join(' ')} is required`);]
It looks like object 'res' has not got method 'error' ...
dquinn40 (3) [Avatar] Offline
#2
I've run into the same issue and am surprised more people haven't mentioned it. As you mentioned it seems the 'res' object does not have an error method. My guess is 'res' should be replaced with 'console.
382843 (1) [Avatar] Offline
#3
I'm reading MEAP V12. The `error` is a function that will be added to `res` in a middleware called `messages` that will be covered later in the chapter.

Just refer to the actual code on github: https://github.com/alexyoung/nodejsinaction

However I should say the content can be reviewed to be more user friendly.