Skip to content

Instantly share code, notes, and snippets.

@wildermuthn
Created March 13, 2014 22:13
Show Gist options
  • Save wildermuthn/9538180 to your computer and use it in GitHub Desktop.
Save wildermuthn/9538180 to your computer and use it in GitHub Desktop.
(defun insert-op (op)
(setf *operations* (append *operations* op)))
; (insert-op (create-op "mail" "mail"))
(defmacro create-op (noun &body body)
`(insert-op '((if (equal noun ,noun)
,@body))))
; (create-op "mail" "sending mail")
; (create-op "echo" (getf params :value))
(defmacro get-ops ()
*operations*)
; *operations*
; (cond *operations*)
; (get-ops)
; (eval)
(defun post-request (route params)
(let* ((path-elms (cl-utilities:split-sequence #\/ route :remove-empty-subseqs t))
(verb (car path-elms))
(noun (cadr path-elms)))
(format *logs* "~%POST REQUEST: ~a ~a ~a~%" route params path-elms)
(check-permissions verb noun params
(or
(if (equal verb "login")
(login-user params))
(if (equal verb "op")
(get-ops))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment