I created for myself my assistant, which does not seem to be the best solution.
Helpers = { toAbsolute: ( url, req ) -> 'http://' + req.headers.host + url } DynamicHelpers = { req: ( req, res ) -> req } exports.Helpers = Helpers exports.DynamicHelpers = DynamicHelpers
I add helpers to the app.coffee file:
helpers = require './helpers.js'
In my [jade view], this is what I do to get the absolute URL from the relative URL:
| <a href="#{ toAbsolute( '/relativeUrl', req ) }">link text</a>
source share