pedestal

2019-07-12T04:22:02.029500Z

I'm getting completely swamped with DEBUG warning messages in my repl and can't see any of my own debugging.

2019-07-12T04:23:54.029800Z

but I can't figure out how to control the logging level.

Joe Lane 2019-07-12T13:13:07.030300Z

@braden.shepherdson logback.xml under the config directory if memory serves me right.

macrobartfast 2019-07-12T15:27:58.032400Z

I like the swagger-ui route luminus provides but I want to switch to pedestal... what's an approach to integrating swagger into pedestal so that I can get a swagger ui webpage? I looked online but the various projects I happened across don't seem maintained (but please refer them anyway in case I missed one).

macrobartfast 2019-07-12T15:30:07.034500Z

it seems like a nice all around pedestal based service might provide both the ability to listen to a queue and do things with that as well as have a REST interface with a user interface web page (I know that's probably a lot of things to put into every service but would allow for maximum flexibility and team access).

2019-07-12T15:41:25.035400Z

@lanejo01 ah, I had such a file generated but couldn't see why it wasn't being picked up. turns out it needs to be in the classpath. I added it to my boot, and now I'm not drowning in messages anymore.

1👍
2019-07-12T15:42:45.037Z

my new problem is that I can't get the ::http/routes (fn [] ...) style to work. that spews errors about trying to use nil as an interceptor. the docs suggest this is allowed, and I'm hoping that doing (route/expand-routes (deref #'service/routes)) will make it dynamic for REPL based development.

2019-07-12T15:43:42.037600Z

but even just replacing my (route/expand-routes service/routes) (which works) with #(route/expand-routes service/routes) fails.

2019-07-12T16:02:16.038900Z

@braden.shepherdson if you are passing the service map through io.pedestal.http/default-interceptors you don’t need to explicitly expand routes unless :io.pedestal.http/routes is a fn

2019-07-12T16:03:11.040200Z

Also, the service template using ::server/routes #(route/expand-routes (deref #'service/routes)) in run-dev to facilitate local dev

2019-07-12T16:03:28.040400Z

so that should work for you

2019-07-12T16:03:57.041Z

I don’t recommend using a fn for routes outside of dev because it’s evaluated on every request

2019-07-12T16:09:44.041800Z

yeah, I'm trying to do the same as the template (I'm using boot, not lein, so I didn't use the template directly) and I get a convoluted error when I pass a function.

2019-07-12T16:36:16.042500Z

hrm, and you are doing ::server/routes #(route/expand-routes (deref #'service/routes))?

2019-07-12T16:57:09.043100Z

yes. as far as I can tell I'm running exactly the same setup as the template.

2019-07-12T17:00:05.043400Z

even just (fn [] service/routes) explodes.

2019-07-12T17:00:15.043700Z

well I don’t expect that to work

2019-07-12T17:00:19.044Z

while service/routes unwrapped works.

2019-07-12T17:00:25.044200Z

because the routes are not expanded

2019-07-12T17:00:28.044400Z

ah, I see.

2019-07-12T17:01:00.045300Z

well, (fn [] (route/expand-routes service/routes) fails too.

2019-07-12T17:01:17.045700Z

io.pedestal.http/default-interceptors will create the routing interceptor for you and, if :io.pedestal.http/routes is not a fn, it will expand it.

2019-07-12T17:03:20.046100Z

what does service/routes look like?

2019-07-12T17:03:31.046500Z

I've removed all of my routes from it.

2019-07-12T17:03:32.046600Z

because that should work

2019-07-12T17:04:10.046900Z

works

2019-07-12T17:04:38.047300Z

so it's just the template now.

2019-07-12T17:07:30.047500Z

that's what I've got.

2019-07-12T17:11:11.049100Z

hrm, Without seeing code I can’t determine why it’s not working. What I pasted works in a freshly generated service.

2019-07-12T17:11:25.049400Z

Pedestal 0.5.7, Clojure 1.9.0, and I restarted my REPL for good measure.

2019-07-12T17:11:40.049700Z

I'm diffing the files looking for variations.

2019-07-12T17:13:59.050600Z

there! I figured it out with the diff. I had shuffled some pieces between files, and then put them back. my routes had

`service/about-page
; where they needed
`about-page

2019-07-12T17:14:46.051300Z

which produces no error, but of course those symbols are not defined.

2019-07-12T17:15:14.051800Z

thanks for the help debugging. I'm new to Pedestal and struggling, as always with a new framework, to figure out the right incantations for the magic.

2019-07-12T17:16:12.052Z

no problem!

2019-07-12T17:21:11.053800Z

the sad part of this is that I'm debugging this side project during my 90-second builds at work. it just underscores the insane productivity of Clojure that I can reload things into my REPL with vim-fireplace and it's already live in my server.

2019-07-12T17:22:05.054700Z

it's mind-boggling that people object to parens and dynamic types when those are the two dev experiences.

2💯