addRoute()
Description
Adds a new route to your application.
Function Syntax
addRoute(name, pattern [, controller, action ])
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string |
Yes | |
Name for the route. |
pattern |
string |
Yes | |
The URL pattern for the route. |
controller |
string |
No | |
Controller to call when route matches (unless the controller name exists in the pattern). |
action |
string |
No | |
Action to call when route matches (unless the action name exists in the pattern). |
Examples
<!--- Adds a route which will invoke the `profile` action on the `user` controller with `params.userName` set when the URL matches the `pattern` argument --->
<cfset addRoute(name="userProfile", pattern="user/[username]", controller="user", action="profile")>
