Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Compile to non-linear routing strategies

Aperta
#467 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
clojure
Ambito
api, backend

Direzione di ricerca

Non vengono indicati file o test. Inizia tracciando le macro di endpoint context e di verbo HTTP, quindi esamina come si espandono nelle route Compojure e come vengono gestite le funzioni endpoint separate. Il lavoro è completato quando viene supportata una strategia di routing non lineare più efficiente, incluso il routing basato sul verbo HTTP, senza perdere le route al di fuori del context immediato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

These will probably have to be different than reitit's since route conflicts are idiomatic. We'll probably want more types of routing between trie and linear.

I think routing based on HTTP verb is a good start;

e.g.,

(context "/foo" []
  (GET "/bar" [] (ok 1))
  (POST "/bar" [] (ok 1))
  (PUT "/bar" [] (ok 1))
  (PATCH "/bar" [] (ok 1)))
=>
(context "/foo" req
  (case (get-http-verb req)
    :GET (GET "/bar" [] (ok 1))
    :POST (POST "/bar" [] (ok 1))
    :PUT (PUT "/bar" [] (ok 1))
    :PATCH (PATCH "/bar" [] (ok 1))))

This could probably be achieved at runtime by reifying some of the structure of a route macro at runtime.

Maybe a static context can communicate to its endpoints to return a data representation of themselves instead of expanding to compojure and the static context can compile a more efficient router.

This could be accomplished more dynamically by having context bind a dynamic variable and expanding endpoints to code that checks for this variable to decide whether to return a data representation or a compojure route.

This has the advantage over static transformation under a context of working even if the endpoint is not directly under the context (say, separated by a function call).

Lingua principale
Clojure
Stelle
1.1k
Fork
145
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di metosin/compojure-api

Tutte le issue di metosin/compojure-api

Issue simili

Altre issue su Clojure

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.