Configuration
collection()
Signature
Section titled “Signature”collection() — returns struct
Available in: mapper
Category: Routing
Description
Section titled “Description”A collection route doesn’t require an id because it acts on a collection of objects. photos/search is an example of a collection route, because it acts on (and displays) a collection of objects.
Examples
Section titled “Examples”<cfscript>
// 1. Add a search route acting on the photos collection (GET /photos/search)
mapper()
.resources(name="photos", nested=true)
.collection()
.get("search")
.end()
.end()
.end();
// 2. Add multiple collection routes (GET /articles/featured, POST /articles/bulk-delete)
mapper()
.resources(name="articles", nested=true)
.collection()
.get("featured")
.post("bulkDelete")
.end()
.end()
.end();
</cfscript>