coldfusion Creating REST APIs in coldfusion The interface


Example

<cfscript>
    api_request = GetHttpRequestData();
    api = createObject("component","myAPI").init();
</cfscript>

<cfif api_request.method is 'GET'>
    <cfoutput>#api.welcome()#</cfoutput>
<cfelseif api_request.method is 'POST'>
    <cfheader statuscode="500" statustext="Internal Server Error" />
</cfif>