pandeiro / boot-http

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

Support for Aleph? #39

Open neilwashere opened 8 years ago

neilwashere commented 8 years ago

Although it's still in beta, Aleph is quite an interesting ring compatible server in that it can take handlers that return a manifold deferred.

Plugging it in with low effort requires the default handler middleware to be removed. That's fine for my needs right now. What would you like to see from a PR that included the ability to run Aleph instead of Jetty or httpkit? Is this something you would even consider?

Forked version using Aleph: https://github.com/neilwashere/boot-http

pandeiro commented 8 years ago

I like it! My one change would be for the option to be named -S / --server instead of web, which seems more descriptive and parallels the variable names in the implementation. Thanks for proposing this!

pandeiro commented 8 years ago

Plugging it in with low effort requires the default handler middleware to be removed.

I added a line comment to the commit in your fork asking there; but I'll ask here. Why is this? Could it be made to work with those middleware? Could those middleware be elided only when the server specified is aleph, and not, for instance, httpkit?

boxxxie commented 8 years ago

would love for you to make a PR and get this merged.... :dancer:

neilwashere commented 8 years ago

If there is appetite for this addition then I'll proceed. I wasn't too sure if it was overstepping what this lib is offering.

I'll have a think about something not too messy for including the default middleware on a server other than Aleph (the reason being that Aleph accepts a handler that can return a deferred value. Regular middleware will blow up on that). I agree with the -S --server switch and will have a think about that too. There is a server def'd in the code and I was a little worried about shadowing.

boxxxie commented 8 years ago

if someone is going to use the aleph option, or any option for that matter, i hope they do at least a little bit of reading about it. aleph is good for me as i'm using yada. right now yada is only able to be used with aleph. i think that if people are able to spend the time implementing a server, it should be included in the lib. if the server is funnly like pedestal or aleph, then that could be covered in documentation.

would it be possible to implement a plugin system for this boot-middlewear? allowing people to add servers without effecting the repo?

pandeiro commented 8 years ago

I am not sure how we could make this pluggable, as the implementation details of the different servers right now are coupled to how boot-http starts and stops them. But I'd love to hear ideas.

Re: aleph, I'd be interested in adding it, for sure. I don't think it's overstepping. It would be nice however to maintain the same semantics as the other server options, namely ability to serve a directory and resources, serve just from the resource path, or serve a handler with optional reloading. I don't know enough about aleph to know if it's easy to cover all of those.

nha commented 8 years ago

Yada ( https://github.com/juxt/yada ), which sits above Aleph, has support for serving directory etc. and is now past 1.0 so it might be worth investigating.