I have read the documentation about Controllers to generate response in actions. But I am having questions about some other non-controller views. In the config/views,
'/':{view:'homepage'}
I am wondering, if I want to pass in parameters in to the homepage template, how would I do that?
You can pass variables into your template by setting locals
in the route config:
'GET /': {
view: 'homepage',
locals: {
username: 'foo',
email: 'foo@bar.com',
...etc...
}
}
This is equivalent to the following in a controller:
res.view('homepage', {username: 'foo', email: 'foo@bar.com'});