initial
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<cfcomponent extends="taffy.core.api">
|
||||
<cfscript>
|
||||
|
||||
this.name = hash(getCurrentTemplatePath());
|
||||
|
||||
variables.framework = {};
|
||||
variables.framework.debugKey = "debug";
|
||||
variables.framework.reloadKey = "reload";
|
||||
variables.framework.reloadPassword = "true";
|
||||
variables.framework.serializer = "taffy.core.nativeJsonSerializer";
|
||||
variables.framework.returnExceptionsAsJson = true;
|
||||
|
||||
function onApplicationStart(){
|
||||
return super.onApplicationStart();
|
||||
}
|
||||
|
||||
function onRequestStart(TARGETPATH){
|
||||
return super.onRequestStart(TARGETPATH);
|
||||
}
|
||||
|
||||
// this function is called after the request has been parsed and all request details are known
|
||||
function onTaffyRequest(verb, cfc, requestArguments, mimeExt){
|
||||
// this would be a good place for you to check API key validity and other non-resource-specific validation
|
||||
return true;
|
||||
}
|
||||
|
||||
</cfscript>
|
||||
</cfcomponent>
|
||||
@@ -0,0 +1,6 @@
|
||||
<!---
|
||||
DO NOT DELETE THIS FILE
|
||||
===============================
|
||||
This file is necessary for Taffy to work, but should be blank.
|
||||
All requests funnel through it, but are handled by framework internal functionality.
|
||||
--->
|
||||
@@ -0,0 +1,17 @@
|
||||
<cfcomponent extends="taffy.core.resource" taffy:uri="/date" hint="Collection of dates">
|
||||
|
||||
<cffunction name="get" access="public" output="false" hint="Get some collection of dates">
|
||||
|
||||
<cfset var qry = queryNew("id,foo", "integer,date") />
|
||||
<cfset var i = 0 />
|
||||
<cfloop from="1" to="15" index="i">
|
||||
<cfset tmp = queryAddRow(qry) />
|
||||
<cfset tmp = querySetCell(qry, "id", i) />
|
||||
<cfset tmp = querySetCell(qry, "foo", dateadd("s",RandRange(1, 5000),now())) />
|
||||
</cfloop>
|
||||
|
||||
<cfreturn representationOf(queryToArray(qry)).withStatus(200) />
|
||||
|
||||
</cffunction>
|
||||
|
||||
</cfcomponent>
|
||||
@@ -0,0 +1,27 @@
|
||||
<cfcomponent extends="taffy.core.resource" taffy:uri="/dateCalback" hint="Collection of dates">
|
||||
|
||||
<cffunction name="formatDate" access="private" output="false" hint="Format dates in ISO 8601 format">
|
||||
<cfargument name="row" type="any" required="yes" />
|
||||
|
||||
<cfif isDate(row.foo)>
|
||||
<cfset row.foo = dateFormat(row.foo,'yyyy-mm-dd')&'T'&timeFormat(row.foo, 'HH:mm:ss.lZ')>
|
||||
</cfif>
|
||||
|
||||
<cfreturn row>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="get" access="public" output="false" hint="Get some collection of dates">
|
||||
|
||||
<cfset var qry = queryNew("id,foo", "integer,date") />
|
||||
<cfset var i = 0 />
|
||||
<cfloop from="1" to="15" index="i">
|
||||
<cfset tmp = queryAddRow(qry) />
|
||||
<cfset tmp = querySetCell(qry, "id", i) />
|
||||
<cfset tmp = querySetCell(qry, "foo", dateadd("s",RandRange(1, 5000),now())) />
|
||||
</cfloop>
|
||||
|
||||
<cfreturn representationOf(queryToArray(qry,formatDate)).withStatus(200) />
|
||||
|
||||
</cffunction>
|
||||
|
||||
</cfcomponent>
|
||||
Reference in New Issue
Block a user