Fork me on GitHub
#pedestal
<
2021-10-06
>
v3ga18:10:06

Yeah I believe so. I think my question is more architecture based opposed to pedestal but that is indeed what I'm after. I'll take a look and I'm still trying to decide how I'm going to handle this. I'm looking to both create static pages and more dynamic pages.

simongray14:10:00

What I do is just use the built-in Pedestal interceptor for content negotation. Then I have a map of content-type->body-fn for the endpoint in question which is used by the handler (and the keys of the map are used by the content-negotiation interceptor). The endpoint then just creates content based on the negotiated content type.

👍 1
v3ga04:10:04

Exactly what I wanted. I was also wondering if this could be done using multimethods in some way. I was watching a video on Clojurescript and that popped into my mind as a possible solution. Newbie thoughts…. But yes you're doing exactly what I want. I'm over engineering a cms and from my view the page will be fairly dynamic but I'd like to create static pages server side as well.

👍 1
simongray10:10:16

Glad I could help. Yup, multi-methods can be used too, but personally I rarely use them since I prefer simpler things such as maps. I guess if you nee extensibility, multi-methods are the better choice.

👍 1
v3ga04:10:04

Exactly what I wanted. I was also wondering if this could be done using multimethods in some way. I was watching a video on Clojurescript and that popped into my mind as a possible solution. Newbie thoughts…. But yes you're doing exactly what I want. I'm over engineering a cms and from my view the page will be fairly dynamic but I'd like to create static pages server side as well.

👍 1