WLambda WASM Evaluator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

37 lines
1017 B

!@import u util;
#!@import a auth;
!:global auth_realm = \ "wlasm" ;
!:global local_endpoint = \ "0.0.0.0:19099" ;
!:global file_prefix = { || "/files" };
!:global file_path = { || "webdata" };
!:global need_auth = { ||
$false
};
#!:global auth = { a:auth[[@]] };
!:global req = {
!(method, path, data, url, qp) = @;
!data = block :from_req {
!t = std:str:cat method ":" path;
u:regex_match t $[
# $q"^GET:/journal/data/entries/(\d+)", {
# return :from_req ~
# db:exec "SELECT * FROM entries WHERE id=?" _.1;
# },
];
$e $["No URL Handler!", t]
};
(is_err data) {
std:displayln :ERROR " " (unwrap_err data | str);
(is_map ~ unwrap_err data) { unwrap_err data } {
${
status = 500,
content_type = "text/plain",
body = unwrap_err data,
}
};
} { ${ data = data } };
};