eudoxia0 / lucerne

A web framework for Common Lisp, built on Clack
http://borretti.me/lucerne/
142 stars 19 forks source link

How to access the query parameters ? #24

Closed vindarel closed 7 years ago

vindarel commented 7 years ago

Hi, I like the with-params macro, but I don't see something equivalent for the url query parameters. How can we access them ? I didn't find anything in the doc nor in the code. I bet they are in a clack *request* object, named query-string, but I don't know how to access them: clack is not documented and this help isn't clear on that (BTW, how to explore the *request* in slime's debugger, while I'm on a break for instance ? it only prints as "CLACK:REQUEST<REQUEST>") Thanks

ghost commented 7 years ago

Please use (clack.request:parameter *request* "your-query-string-here")

vindarel commented 7 years ago

Thank you. I ended up with (assoc "the-param" (clack.request:query-parameter lucerne:*request*) :test 'string=).

It would be nice if Lucerne provided a macro for that, similar to with-params. (Let's see if I come to write mine.)

doc to Clack api: http://quickdocs.org/clack/api#package-CLACK.REQUEST Slime inspector: https://common-lisp.net/project/slime/doc/html/Inspector.html#Inspector (we can press i on a frame (a backtrace) to inspect a value, e to just evaluate it). More on SO.