Web Interface Endpoint Tag
The web interface endpoint tag can be used to add a new endpoint to Jancy’s web interface.
<jyl> <webinterface-endpoint path="another-custom-endpoint"> jancy.console.log("I'm another custom endpoint"); return true; </webinterface-endpoint> </jyl>
Format
Web interface endpoint start and end with a webinterface-endpoint
tag.
webinterface-endpoint
tag properties:
path
required defines the path of the endpoint.
Jancy will always prepend
/extra
to the path.
The contents of the webinterface-endpoint
tag will be used as the body of a Javascript function that will be executed when a request is received on the custom endpoint. The function generated will be called with the following arguments:
jancy
(Jancy
)parsedURL
(URL
)req
(http.IncomingMessage)res
(http.ServerResponse)
If the endpoint is defined as:
<jyl> <webinterface-endpoint path="another-custom-endpoint"> jancy.console.log("I'm another custom endpoint"); return true; </webinterface-endpoint> </jyl>
the generated Javascript would be:
function f(jancy, parsedURL, req, res) { jancy.console.log("I'm another custom endpoint"); return true; }