My REST API in ColdFusion runs properly on ColdFusion 2021 Update 1 but doesn’t work on another server with ColdFusion 2021 Update 11. Is there a fix for this? It throws the error “404 – File or directory not found.”
a sample code of one of my API is given below
<cffunction name="getcities" restpath="cities" access="remote" returntype="void" httpmethod="GET"
produces="application/json">
<cfset var result={}>
<cfset var data=[]>
<cfset response=structNew()>
<cftry>
<cfset data=objUser.getCities()>
<cfset response.status="200">
<cfset result["success"]=true>
<cfset result["data"]=data>
<cfset response.content=result>
<cfcatch type="any">
<cfset result["success"]=false>
<!--- <cfset result["message"]="Problem executing database query " & #cfcatch["message"]#> --->
<cfset result["data"]= #cfcatch["message"]#>
<cfset response.status="200">
<cfset response.content=result>
</cfcatch>
</cftry>
<cfset restSetResponse(response)>
</cffunction>