Skip to content

Commit

Permalink
Better API handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsz committed Jul 3, 2024
1 parent ac86f9f commit df41d3a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.org
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
* Changes
** 0.5.4-SNAPSHOT
** 0.5.4
- Support for multiple API handlers, which are siloed handlers with their own prefix, middleware and dependencies.
** 0.5.3
- Support for info.sunng/ring-jetty9-adapter
Expand Down
2 changes: 1 addition & 1 deletion meyvn.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{:pom {:group-id "org.danielsz",
:artifact-id "system",
:version "0.5.4-SNAPSHOT",
:version "0.5.4",
:name "system"
:licenses [{:name "Eclipse Public License -v 1.0"
:url "https://opensource.org/license/epl-1-0/"}]},
Expand Down
4 changes: 3 additions & 1 deletion src/system/components/handler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
(defrecord APIHandler [api-route api-prefix api-middleware]
component/Lifecycle
(start [component]
(assoc component :api-route (api-route component))) ;; each api handler can have its own dependencies
(assoc component
:api-route (api-route component)
:api-middleware (postwalk-replace {:component component} api-middleware))) ;; each api handler can have its own dependencies
(stop [component]
(dissoc component :api-route :api-prefix :api-middleware)))

Expand Down

0 comments on commit df41d3a

Please sign in to comment.