-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRoutes.cfm
52 lines (46 loc) · 2 KB
/
Routes.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<cfscript>
// Allow unique URL or combination of URLs, we recommend both enabled
setUniqueURLS(false);
// Auto reload configuration, true in dev makes sense to reload the routes on every request
//setAutoReload(false);
// Sets automatic route extension detection and places the extension in the rc.format variable
// setExtensionDetection(true);
// The valid extensions this interceptor will detect
// setValidExtensions('xml,json,jsont,rss,html,htm');
// If enabled, the interceptor will throw a 406 exception that an invalid format was detected or just ignore it
// setThrowOnInvalidExtension(true);
// Base URL
if( len(getSetting('AppMapping') ) lte 1){
setBaseURL("http://#cgi.HTTP_HOST#/");
}
else{
setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/");
}
// Your Application Routes
addRoute(pattern="register", handler="Register", action={ GET = "index", POST = "submit" } );
addRoute(pattern="login/step2", handler="Security", action={ GET = "step2", POST = "verifyCode" } );
addRoute(pattern="login", handler="Security", action={ GET = "login", POST = "authenticate" } );
addRoute(pattern="recipes/new", handler="recipes", action="new");
addRoute(pattern="recipes/:id/:action", handler="recipes");
addRoute(pattern="recipes/:id", handler="recipes", action="show");
addRoute(pattern=":handler/:action?");
/** Developers can modify the CGI.PATH_INFO value in advance of the SES
interceptor to do all sorts of manipulations in advance of route
detection. If provided, this function will be called by the SES
interceptor instead of referencing the value CGI.PATH_INFO.
This is a great place to perform custom manipulations to fix systemic
URL issues your Web site may have or simplify routes for i18n sites.
@Event The ColdBox RequestContext Object
**/
function PathInfoProvider(Event){
/* Example:
var URI = CGI.PATH_INFO;
if (URI eq "api/foo/bar")
{
Event.setProxyRequest(true);
return "some/other/value/for/your/routes";
}
*/
return CGI.PATH_INFO;
}
</cfscript>