Methods
pathFor(name, params) → {String}
Generate URL path(without host) for route. Takes the route name and a map of named params.
Parameters:
Name | Type | Description |
---|---|---|
name
|
String | Router Name |
params
|
Object | Other params |
- Source:
Example
```js
app.get('home', '/index.htm', 'home.index');
ctx.helper.pathFor('home', { by: 'recent', limit: 20 })
=> /index.htm?by=recent&limit=20
```
urlFor(name, params) → {String}
Generate full URL(with host) for route. Takes the route name and a map of named params.
Parameters:
Name | Type | Description |
---|---|---|
name
|
String | Router name |
params
|
Object | Other params |
- Source:
Example
```js
app.get('home', '/index.htm', 'home.index');
ctx.helper.urlFor('home', { by: 'recent', limit: 20 })
=> http://127.0.0.1:7001/index.htm?by=recent&limit=20
```