Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (45 sloc) 1.48 KB
/*
* File responsible for launching Hypereval.
*
* Notice, this file also seconds as a URL resolver for evaluating _"page"_ Hypereval snippets.
* To load a page Hypereval snippet simply add the name of your snippet as the second part of your
* URL, and it will load that snippet as a page, instead of launching
* Hypereval itself. Example `/hypereval/some-page-snippet`.
*/
/*
* Signal node, to separate arguments from the rest of lambda.
*/
.signal
/*
* Checking if this is a request for a specific "page" snippet.
*/
micro.url.get-entities
if:x:/@micro.url.get-entities/*?count
>:int:1
/*
* This is a request for a "page snippet".
*
* Evaluating snippet, making sure we wrap our evaluation in a try/catch block,
* such that we can return intelligent error feedback to client if snippet doesn't exist.
*/
try
/*
* Invoking event responsible for evaluating the requests page snippet.
*/
hypereval.snippets.evaluate:x:/@micro.url.get-entities/1?name
type:page
catch
/*
* No such snippet found.
*/
p5.web.response.set-status-code:404
p5.web.response.set-status-description:404 - No such functioning snippet found
p5.web.echo:x:/@message?value
else
/*
* This is not a request for a specific page, hence we load up main wireframe for
* Hypereval.
*/
add:x:/+
src:x:/@.signal/--/<-
micro.evaluate.file:@HYPEREVAL/helpers/launch-hypereval.hl