Return to v2.5.0 docs

root()


Configuration Routing struct mapper


Create a route that matches the root of its current context. This mapper can be used for the application's web root (or home page), or it can generate a route for the root of a namespace or other path scoping mapper.

Name Type Required Default Description
to string No Set controller##action combination to map the route to. You may use either this argument or a combination of controller and action.
mapFormat boolean No Set to true to include the format (e.g. .json) in the route.
<cfscript>

mapper()
    .namespace("api")
        // Map the root of the `api` folder to the `index` action of the `apis`
        // controller.
        .root(controller="apis", action="index")
    .end()

    // Map the root of the application to the `show` action of the `dashboards`
    // controller.
    .root(to="dashboards##show")
.end();

</cfscript>

Related Functions

Routing