Pergunta

Suppose I have URLs with the format:

Is it possible to write a single handler that matches an arbitrary number of URI parts after http://example.com/node ?

Foi útil?

Solução

Yes, you can use a wildcard * on the routes:

(GET "/node/*" request (handle request))

You can also define a regular expression over the variable part:

 (GET ["/node/:params", :params #"[^.]+.fn"] [params :as request] (handle params))

That sample will accept all /node/something.fn urls.

Compojure uses clout for the matching part you can read there more alternatives.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top