metosin/reitit

Missing `enqueue` method to use `routing-interceptor` with `sieppari`?

Open

#599 opened on Mar 21, 2023

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Clojure (1,569 stars) (261 forks)batch import
help wanted

Description

Hi there! First off thank you for providing such a high-performance and versatile library, reitit allows one to nicely compose so many ideas from the clojure ecosystem :rocket:

In an effort to have an HTTP server whose execution flow is ridicolously straightforward to understand, I'm trying to achieve a fully interceptor driven server, where each interceptor has one and only one job.

For example the interceptor stack might look like:

  • exceptions interceptor
  • format interceptor
  • default handlers interceptor
  • routing interceptor

That said, I'm a bit puzzled as to how one is supposed to use the routing interceptor. Below is how I configured the interceptor, but if I try to run it, it rightfully complains that the sieppari executor doesn't have an enqueue method.

Is there a reason why the sieppari executor can't have an enqueue method? If not, would you be happy to accept a PR introducing it?

(reitit.http/routing-interceptor
    (reitit.http/router ["/api"
                         {:get (fn [req] {:status 200
                                          :body {:res 4 :params (:query-params req)}})}])
    nil
    {:executor reitit.interceptor.sieppari/executor})

Thanks, Simon

Contributor guide