Back
scope()
Set any number of parameters to be inherited by mappers called within this matcher's block. For example, set a package or URL path to be used by all child routes.
<cfscript> mapper() // All routes inside will use the `freeForAll` controller. .scope(controller="freeForAll") .get(name="bananas", action="bananas") .root(action="index") .end() // All routes's controllers inside will be inside the `public` package/subfolder. .scope(package="public") .resource(name="search", only="show,create") .end() // All routes inside will be prepended with a URL path of `phones/`. .scope(path="phones") .get(name="newest", to="phones##newest") .get(name="sortOfNew", to="phones##sortOfNew") .end() .end(); </cfscript>
Copied!