Documentation / zerotal / index / route
Function: route()
route(
name,params?):string
Defined in: packages/core/src/router/Router.ts:286
Generate a URL for a named route, substituting :param segments. Extra params that don't match a :segment become query-string entries.
Parameters
name
string
params?
Record<string, string | number> = {}
Returns
string
Throws
when the route name is unknown or a required :param is missing.
Example
route('posts.show', { slug: 'hello' }) // '/posts/hello'
route('search', { q: 'reno', page: 2 }) // '/search?q=reno&page=2'