Liking cljdoc? Tell your friends :D

wagoe.platform.shell.interfaces.http.routes

Common HTTP routing infrastructure and standard endpoints.

This namespace provides the foundational routing structure for the application, including standard endpoints like health checks and API documentation, along with infrastructure for injecting module-specific routes.

Features:

  • Health check endpoints
  • OpenAPI/Swagger documentation routes
  • Module route injection system
  • Common route middleware configuration
  • Standardized route structure
Common HTTP routing infrastructure and standard endpoints.

This namespace provides the foundational routing structure for the application,
including standard endpoints like health checks and API documentation, along
with infrastructure for injecting module-specific routes.

Features:
- Health check endpoints
- OpenAPI/Swagger documentation routes
- Module route injection system
- Common route middleware configuration
- Standardized route structure
raw docstring

api-docs-routesclj

(api-docs-routes config)

Create OpenAPI/Swagger documentation routes with CSS fix for path rendering.

Args: config: Application configuration

Returns: Vector of API documentation route definitions

Create OpenAPI/Swagger documentation routes with CSS fix for path rendering.

Args:
  config: Application configuration

Returns:
  Vector of API documentation route definitions
sourceraw docstring

create-appclj

(create-app config module-routes & options)

Create a complete application with routes and handlers.

This is a convenience function that combines router creation and handler setup into a single step for simple applications.

Args: config: Application configuration module-routes: Vector of module-specific route definitions options: Same options as create-router plus handler options

Returns: Complete Ring application handler

Example: (def app (create-app config user-routes {:error-mappings user-errors :additional-health-checks health-fn}))

Create a complete application with routes and handlers.

This is a convenience function that combines router creation and handler
setup into a single step for simple applications.

Args:
  config: Application configuration
  module-routes: Vector of module-specific route definitions
  options: Same options as create-router plus handler options

Returns:
  Complete Ring application handler

Example:
  (def app (create-app config user-routes
                      {:error-mappings user-errors
                       :additional-health-checks health-fn}))
sourceraw docstring

create-handlerclj

(create-handler router
                &
                {:keys [not-found-handler method-not-allowed-handler]
                 :or {not-found-handler (http-common/create-not-found-handler)
                      method-not-allowed-handler nil}})

Create a complete Ring handler with routes and fallback handlers.

Serves static resources from /public directory BEFORE routing, bypassing content negotiation middleware that causes 406 errors.

Args: router: Reitit router instance options: Optional configuration map

Returns: Ring handler function

Example: (create-handler (create-router config module-routes))

Create a complete Ring handler with routes and fallback handlers.

Serves static resources from /public directory BEFORE routing,
bypassing content negotiation middleware that causes 406 errors.

Args:
  router: Reitit router instance
  options: Optional configuration map

Returns:
  Ring handler function

Example:
  (create-handler (create-router config module-routes))
sourceraw docstring

create-routerclj

(create-router
  config
  module-routes
  &
  {:keys [additional-health-checks error-mappings extra-middleware]
   :or {additional-health-checks nil error-mappings {} extra-middleware []}})

Create a complete router with common routes and injected module routes.

Args: config: Application configuration module-routes: Vector of module-specific route definitions options: Optional configuration map with: - :additional-health-checks - Function for additional health checks - :error-mappings - Custom error type mappings - :middleware - Additional middleware to include

Returns: Reitit router with all routes configured

Example: (create-router config user-routes {:error-mappings {:user-not-found [404 "User Not Found"]} :additional-health-checks (fn [] {:database "connected"})})

Create a complete router with common routes and injected module routes.

Args:
  config: Application configuration
  module-routes: Vector of module-specific route definitions
  options: Optional configuration map with:
    - :additional-health-checks - Function for additional health checks
    - :error-mappings - Custom error type mappings
    - :middleware - Additional middleware to include

Returns:
  Reitit router with all routes configured

Example:
  (create-router config user-routes
                 {:error-mappings {:user-not-found [404 "User Not Found"]}
                  :additional-health-checks (fn [] {:database "connected"})})
sourceraw docstring

health-routesclj

(health-routes config)
(health-routes config additional-checks)

Create standard health check routes.

Args: config: Application configuration additional-checks: Optional function for additional health checks

Returns: Vector of health check route definitions

Create standard health check routes.

Args:
  config: Application configuration
  additional-checks: Optional function for additional health checks

Returns:
  Vector of health check route definitions
sourceraw docstring

wrap-common-middlewareclj

(wrap-common-middleware handler)
(wrap-common-middleware handler error-mappings)

Wrap a handler with the standard common middleware stack.

This is useful when you need to apply the same middleware to custom handlers that aren't part of the main route structure.

Args: handler: Ring handler function error-mappings: Optional custom error mappings

Returns: Handler wrapped with common middleware

Wrap a handler with the standard common middleware stack.

This is useful when you need to apply the same middleware to custom
handlers that aren't part of the main route structure.

Args:
  handler: Ring handler function
  error-mappings: Optional custom error mappings

Returns:
  Handler wrapped with common middleware
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close