(execute-command command-map request method-request)
get the function from the command-map according the method-name and execute this function with args return the execute result
get the function from the command-map according the method-name and execute this function with args return the execute result
(export-commands ns fn-names & [options])
export all functions (fn-names is null or empty) or specify functions in the namespace ns invoker of this method must notice the order of the options options: options is a collection include several keys like [ [:requre-context true] [:params-checks ...] [... ...] ]
the meaning of option: :require-context (true or false default false) whether this command must have context :params-checks check parameters of the method be invoked statisfy the sepcific requirements example : {0 [:username]} --> the first parameter must equals (get-in context [:username])
for example : (export-commands 'clojure.core nil) (export-commands "clojure.core" nil) (export-commands 'clojure.core ['+]) (export-commands 'clojure.core ["+"] [ [:require-context true] [:params-check {0 [:id]}] ])
export all functions (fn-names is null or empty) or specify functions in the namespace ns invoker of this method must notice the order of the options options: options is a collection include several keys like [ [:requre-context true] [:params-checks ...] [... ...] ] the meaning of option: :require-context (true or false default false) whether this command must have context :params-checks check parameters of the method be invoked statisfy the sepcific requirements example : {0 [:username]} --> the first parameter must equals (get-in context [:username]) for example : (export-commands 'clojure.core nil) (export-commands "clojure.core" nil) (export-commands 'clojure.core ['+]) (export-commands 'clojure.core ["+"] [ [:require-context true] [:params-check {0 [:id]}] ])
(help-commands commands)
return the command list
return the command list
(rpc-invoke command-map request rpc-request)
invoke rpc method rpc-request can a map (one invoke) or a collection of map (multi invokes)
invoke rpc method rpc-request can a map (one invoke) or a collection of map (multi invokes)
(start)
(start options)
start jetty server options : base on options of run-jetty of ring jetty adaptor and add several more :fn-get-context => function to get the context (fn-get-context token) :token-cookie-key => the cookie name according to the token :cookie-attrs => the cookie default attributes, include domain or others reference ring wrap-session :commands => the custom commands (atom of map) to be exported. (optional)
start jetty server options : base on options of run-jetty of ring jetty adaptor and add several more :fn-get-context => function to get the context (fn-get-context token) :token-cookie-key => the cookie name according to the token :cookie-attrs => the cookie default attributes, include domain or others reference ring wrap-session :commands => the custom commands (atom of map) to be exported. (optional)
(with-commands a-commands & body)
if you want to define another commands, using this macro, and in it invoke export-commands function lile:
if you want to define another commands, using this macro, and in it invoke export-commands function lile:
(wrap-commands handler new-commands)
enable binding a custom commands map new-commands must be a atom of map
enable binding a custom commands map new-commands must be a atom of map
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close