metosin/reitit

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

Open

#599 aperta il 21 mar 2023

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Clojure (261 fork)batch import
help wanted

Metriche repository

Star
 (1569 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor