In my Yesod project i have the following route:
/api/hide/thread/#Text/#Int ApiHideThreadR GET
I want to request it on the client side with javascript:
function hideThreadCompletely(threadId, board) {
$.getJSON("/api/hide/thread/"+board+"/"+threadId, function(data) {
$('#thread-'+threadId).hide();
});
}
But i can't use @{ApiHideTHreadR}
because Yesod requires it's arguments on compile time. What is the proper solution for this, if i want API URLS to look like api/board/1/1
and not api/board?bid=1&tid=1
? Keep using manually-defined URL's like "/api/hide/thread/"+board+"/"+threadId
?