Express Tutorial Part 4: Routes and controllers -- potential issue with code

(wm1215) #1

I am new to Express. I recently completed Express Tutorial Part 4: Routes and controllers (

Per the instruction to test the routes given in the last section entitled Testing the routes, I started the website; however, an error response was generated. I searched online, but was unable to find any answers which resolved the issue. Question: Per my search online, others have faced the same problem. Is this an issue with the instructions (i.e., outdated code)? If so, what is the updated code for which file? Please help!

The error message copied from the Command Prompt is pasted below. Thank you!

Error: Route.get() requires a callback function but got a [object Undefined]
at Route.(anonymous function) [as get] (C:\Users\wataru\myapp\express-locallibrary-tutorial\node_modules\express\lib\router\route.js:202:15)
at Function.proto.(anonymous function) [as get] (C:\Users\wataru\myapp\express-locallibrary-tutorial\node_modules\express\lib\router\index.js:510:19)
at Object. (C:\Users\wataru\myapp\express-locallibrary-tutorial\routes\catalog.js:13:8)
at Module._compile (module.js:652:30)
at Object.Module._extensionsā€¦js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)