-
Notifications
You must be signed in to change notification settings - Fork 3
Scopes
dscape edited this page Mar 4, 2011
·
1 revision
Scopes allow you to reuse your constraints for multiple routes:
Request : GET /user/admin
routes.xml : <routes>
<scope>
<constraints>
<id type="string"/>
</constraints>
<lambda>
xdmp:get-current-user() = $id
</lamda>
<put path="user/:id">
<to> user#put </to>
</put>
<get path="user/:id">
<to> user#get </to>
</get>
</scope>
</routes>
Dispatches to : /resource/user.xqy?action=get&id=admin