I'm just starting with Node.js and decided to go for Locomotive. I'm very pleased with the functionality it offers, and the pretty exhaustive documention provided. Still, I don't get how I'm supposed to use the "reverse routing" functionality. In the routing section of the doc the helpers methods are mentioned but I don't understand how to use them inside my Jade views. Here are relevant code samples:
routes.js
module.exports = function routes() {
this.match('myroute', 'myroute#main', {as: 'myroute'});
}
controller/myroute_controller.js
var Controller = require('locomotive').Controller;
var myrouteController = new Controller();
myrouteController.main = function() {
this.render();
}
module.exports = myrouteController;
views/myroute/main.jade
doctype 5
html
body
p the path that lead here is #{myroutePath()}.
I'm expecting the myroutePath() to be automatically available in main.jade, and it seems to be declared, but when I render the view, the server displays this error: Object #<Object> has no method 'urlFor' near my call to myroutePath().
My guess is myroutePath() uses urlFor() internally but this last method isn't available in my view. How am I supposed to use Locomotive's reverse routing ?