socketry / falcon

A high-performance web server for Ruby, supporting HTTP/1, HTTP/2 and TLS.
https://socketry.github.io/falcon/
MIT License
2.62k stars 79 forks source link

Update guide to add `load :rack, :supervisor` #237

Closed adam12 closed 5 months ago

adam12 commented 5 months ago

Types of Changes

Contribution

ioquatix commented 5 months ago

Thanks!

The new service framework makes this approach less important.

However, I'm not sure if we should change the standard documentation at the moment.

In other words, you can write:

# Previous way:
load :rack

rack "myhost" do ...

# Better way:
require "falcon/environment/rack"

service "myhost" do
 include Falcon::Environment::Rack
end

The reason why the latter is better, is because it doesn't require to use falcon host to start, async-service can start it too, and it can be combined with other services, e.g. background job runner, etc.

adam12 commented 5 months ago

Ah, interesting! I was just fixing the docs as I encountered them today, but indeed that seems less magical.

ioquatix commented 5 months ago

My original thinking behind "load ..." was that it would be less "falcon specific". But it turned out not to be useful and probably harmful.