pandeiro / boot-http

A simple HTTP serve task for the Boot build tool
62 stars 34 forks source link

ring handler via compojure #31

Closed magomimmo closed 8 years ago

magomimmo commented 8 years ago

Hi, I'm pretty new to boot.

I'm trying without any success to pass a ring handler (by using compojure as well) to the serve task via the :handler option.

Is there a reference boot project that demonstrated the above scenario? Could be a good idea to try to port the compojure getting started sample to boot?

https://github.com/weavejester/compojure/wiki/Getting-Started

and add static html page to resources/public folder to see what could be a valid build.boot file able to do the same thing?

Thanks so much for your help.

magomimmo commented 8 years ago

I'm closing this issue because I was able to manage the handler. Sorry about that.

pandeiro commented 8 years ago

No problem @magomimmo and sorry I didn't respond sooner.

Just in case you're still figuring out the static files part, the easiest and simplest mechanism IMO is to create a directory in your project to hold these assets and specify it in your build.boot's :resource-paths. That way, boot-http will automatically serve those assets (as resolved via clojure.java.io/resource).

magomimmo commented 8 years ago

Hi @pandeiro ...thanks. Yes I did as you mention... One thing I was thinking about is to have sane defaults shared by the various boot tasks, in such a way that if you do not have specific requirements you could go with those defaults while crossing the various tasks. To make a concrete example, boot uses target as default value for target-path and boot-cljs use the same default as well. It would be nice that boot-http uses that default too and so on. That said, thanks so much for you work!

pandeiro commented 8 years ago

Yeah @magomimmo, actually I think neither boot-cljs not boot-http specifically reference :target-path: that's a boot thing. (The exception is if you want to serve directly from a directory using the :dir option: buy then you have to specify which directory.)