adl-support.rest-support

Application Description Language support - functions useful in generating JSON route handlers.

do-or-server-fail

macro

(do-or-server-fail form status)

Evaluate this form; if it succeeds, return an HTTP response with this status code and the JSON-formatted result as body; if it fails, return an HTTP 500 response.

if-valid-user

macro

(if-valid-user form request error-return)(if-valid-user form request)

Evaluate this form only if there is a valid user in the session of this request; otherwise return the error-return value.

valid-user-or-forbid

macro

(valid-user-or-forbid form request)

Evaluate this form only if there is a valid user in the session of this request; otherwise return an HTTP forbidden response.

with-params-or-error

macro

(with-params-or-error form params required)

Evaluate this form only if these params contain all these required keys; otherwise return an HTTP 400 response.