Upon completion of topic article, conducting the prescribed test in the browser fails with an error indicating a failure to read the authors name (#{book.author.name} in the book_list.pug file). By replacing this code with p #{book} the browser renders a list of books from the mongoDB, with a “dump” of the stored data read. The data reveals that the author variable is a null - thus the failure to read the author’s name. The data in the mongoDB books collection is, in fact, an ObjectId for the specific author in the authors collection. Over the past few days I have tried innumerable changes to the book_list model, controller and view file, and of course compared my files with the files in the tutorial and with the files on GitHub. HELP! Please.
Hi @jrubl9427 and welcome to the community
I haven’t worked through the Express tutorial myself, but I heard of others having problems making the code work, even when they, as you did, compared it to the GitHub repo. It may be that something changed with newer versions of Express.js/Node.js which prevents the code from running correctly.
When you are sure that even the code in the MDN repo doesn’t work correctly, I may be advisable to raise an issue at https://github.com/mdn/content/issues
Sorry that I can’t give you any better advice.
See you,
Michael
Hi Michael - thank you for the reply. As it turns out I eventually found a typo I made in a controller file. Working through to find the error went a long way towards helping me gain understanding. I have since completed the tutorial and have a working app, both locally and deployed. I am embarking today on making my own app based on the process and procedure I have learned from the express tutorial.
Thanks again for taking the time to offer assistance.
All the best
Jim
I’m glad to hear you could solve your problem.
That’s something I also experienced before. Making mistakes is sometimes the best thing to learn and understand.
I wish you all the best on your developer journey.