HTTP server for Admin REST API.
Provides a simple HTTP server using Java's built-in HttpServer that serves RESTful admin endpoints for runtime management.
HTTP server for Admin REST API. Provides a simple HTTP server using Java's built-in HttpServer that serves RESTful admin endpoints for runtime management.
(create-admin-handler {:keys [api-key allowed-origins routes]})Create the main HTTP handler for admin API.
config is a map with: :api-key - Optional API key for authentication :allowed-origins - Optional list of CORS allowed origins :handlers - Handler module with all endpoint handlers :routes - Vector of route definitions
Create the main HTTP handler for admin API. config is a map with: :api-key - Optional API key for authentication :allowed-origins - Optional list of CORS allowed origins :handlers - Handler module with all endpoint handlers :routes - Vector of route definitions
(create-router routes)Create a router function that dispatches to handlers based on method and path.
routes is a vector of route definitions: [{:method :get :pattern "/api/v1/status" :handler handler-fn} {:method :post :pattern "/api/v1/proxies" :handler handler-fn} {:method :delete :pattern "/api/v1/proxies/:name" :handler handler-fn}]
Returns a function that takes (exchange) and returns: {:handler handler-fn :params {:name "value"}} or nil if no match.
Create a router function that dispatches to handlers based on method and path.
routes is a vector of route definitions:
[{:method :get :pattern "/api/v1/status" :handler handler-fn}
{:method :post :pattern "/api/v1/proxies" :handler handler-fn}
{:method :delete :pattern "/api/v1/proxies/:name" :handler handler-fn}]
Returns a function that takes (exchange) and returns:
{:handler handler-fn :params {:name "value"}} or nil if no match.(extract-path-params path pattern)Extract path parameters from a URL path based on a pattern. Pattern uses :param syntax for parameters. Example: (extract-path-params "/api/v1/proxies/web" "/api/v1/proxies/:name") => {:name "web"}
Extract path parameters from a URL path based on a pattern.
Pattern uses :param syntax for parameters.
Example: (extract-path-params "/api/v1/proxies/web" "/api/v1/proxies/:name")
=> {:name "web"}(get-status)Get admin server status.
Returns nil if not running, or map with status info if running.
Get admin server status. Returns nil if not running, or map with status info if running.
(running?)Check if admin server is running.
Check if admin server is running.
(start! {:keys [port api-key allowed-origins routes] :or {port 8081}})Start the admin HTTP server.
config is a map with: :port - Port to listen on (default 8081) :api-key - Optional API key for authentication :allowed-origins - Optional list of CORS allowed origins :routes - Vector of route definitions
Returns true if started successfully, false if already running.
Start the admin HTTP server. config is a map with: :port - Port to listen on (default 8081) :api-key - Optional API key for authentication :allowed-origins - Optional list of CORS allowed origins :routes - Vector of route definitions Returns true if started successfully, false if already running.
(stop!)Stop the admin HTTP server.
Returns true if stopped successfully, false if not running.
Stop the admin HTTP server. Returns true if stopped successfully, false if not running.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |