Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Express Basics Deeper into Routing with Express POST Requests

Brian Foley
Brian Foley
8,440 Points

form doesn't work

Hello, unfortunately I still get an error even after setting up the route that Andrew demonstrates at the end of the video, and I have no idea why my form won't re-render. Here are screenshots of what I have. Any ideas why this doesn't work?

image1 image2 image3 image4

2 Answers

Your code runs fine on my machine. Have you restarted the node server after adding the post route?

Brian Foley
Brian Foley
8,440 Points

Yep, that worked, thanks very much! I'm new to node, so I didn't know I had to do that. How often do I have to restart the node server? How do I know that I need to do that? (Maybe I should take the node course, ha!)

Every time you are making a change to your backend code (node) you need to restart the server. You may want to look into the nodemon module which you can install with npm install nodemon -g I believe you can then start your app with nodemon app.js for example. nodemon will automatically restart your server every time you are saving a change in your backend code. Super efficient

Brian Foley
Brian Foley
8,440 Points

Thanks very much! I'll look into that.

This was shown by example in the Creating a Route with Express video from the first stage of this course.

The pertinent info begins at 05:30 in the video.