Common Lisp Package: CAVEMAN.ROUTE

# Caveman.Route ## SYNOPSIS ;; for Function @url GET "/login" (defun login (req) ;; response ) ;; for Clack Component @url GET "/member/:id" (defclass <member-profile> (<component>) ()) (defmethod call ((this <member-profile>) req) ;; response ) ## DESCRIPTION Caveman.Route provides an useful annotation `url' to define a Caveman Action. ## AUTHOR * Eitarow Fukamachi (e.arrows@gmail.com)

README:

FUNCTION

Public

URL-FOR (SYMBOL &REST PARAMS)

Make an URL for the action with PARAMS. Example: @url GET "/animals/:type" (defun animals (params)) (url-for 'animals :type "cat") ;; => "/animals/cat"

Private

ADD-QUERY-PARAMETERS (BASE-URL PARAMS)

Add a query parameters string of PARAMS to BASE-URL.

DEFINITION-FORM-SYMBOL (DEFINITION-FORM)

Return the symbol of DEFINITION-FORM.

DEFINITION-FORM-TYPE (DEFINITION-FORM)

Return the type of DEFINITION-FORM.

MAKE-URL-RULE (URL &KEY (METHOD GET) REGEXP)

Construct `<url-rule>` and return it. You must always use this function when you need `<url-rule>`.

PROGN-FORM-LAST (PROGN-FORM)

Return the last form of PROGN-FORM which should evaluated at last. If macro forms seen, the macro forms will be expanded using MACROEXPAND-UNTIL-NORMAL-FORM.

URL-ENCODE (STRING &OPTIONAL (EXTERNAL-FORMAT *DEFAULT-EXTERNAL-FORMAT*))

URL-encodes a string using the external format EXTERNAL-FORMAT.

MACRO

Public

URL (METHOD URL-RULE FORM)

Useful annotation to define actions. Example: ;; for Function @url GET "/login" (defun login (req) ;; response ) ;; for Clack Component @url GET "/member/:id" (defclass <member-profile> (<component>) ()) (defmethod call ((this <member-profile>) req) ;; response )

URL->ROUTING-RULE (METHOD URL-RULE FORM)

Convert action form into a routing rule, a list. Example: ((member-profile #<url-rule> #'member-profile) (login-form #<url-rule> #'login-form))

Private

GETF* (PLACE KEY)

Similar to `getf' but allows many types for the `key', String, Keyword or Symbol.

REMF* (PLACE KEY)

Similar to `remf` but allows many types for the `key', String, Keyword or Symbol.

GENERIC-FUNCTION

Private

Undocumented

ADD-ROUTE (THIS ROUTING-RULE)

LOOKUP-ROUTE (THIS SYMBOL)