I have come from using the Play! Framework where putting links in a template involved using the controller object then selecting a method. E.g. @{Controller.method(passedValue)} which was really wonderful.
With my first express/node project I am worried about having orphaned links e.g. /user/new becomes /register. How do I avoid this being a problem?
Well, javascript is a dynamic interpreted language. You’ll never have any compiler that will notify you of broken links. Even if you switch from using URL paths in your templates to getting attributes from a controller object (which would be fine), you have to worry about orphaned links in both cases. Write tests that make sure this stuff doesn’t break.
FYI you are welcome to do the same thing with jade/express. Put the controller object into the “locals” variable when you call jade.render, and then in your template you can do
or something along those lines if you feel that’s cleaner. But still, if you rename the registerURI method to loginURI, you have to worry about going and updating that code to match. That’s the nature of an interpreted language.