The documentation has little information on this subject. If I copy application.serve declaration into my script, I get an error:
Cannot find function serve in object [object Application]
The script file is very simple:
<%
application.serve(function(request, respond, session) {});
%>
I found a presentation with an example on slide #23, but it says I have to require a router. When I do this I get another error.
How is "application.serve" to be used in a proper way?
application.serve
is the centralized entry point in proposed front-controller model. This new model is not finalized and still in an architectural review state.
Under the current model you can directly write function body logic inside Jaggery code block.
request
, respond
, session
are visible to the code section as top level variables.
eg:
<html>
<body>
<%
print("Method : " + request.getMethod() + "<br/>");
%>
</body>
</html>