Search code examples
clojurecompojure-api

Compojure: How to get query parameters as a map


I just created my RESTful service through Luminus using this doc: http://www.luminusweb.net/docs/services.md

Apparently Compojure-API uses Schema library to map the query parameters. However, I would like to be able to get all the query parameters as a single map instead. For instance:

From this GET /api/myapp?color=green&shape=round&height=100 to this {:color "green", :shape "round", :height "100"}

thanks!


Solution

  • Got it.

    I used this as an example (GET "/test" {params :params} (str params)). params is a map with keys and values for the given query params.