Is anyone adding plugs and pipelines to Sinatra?

I’m interested in using Phoenix-style plugs and pipelines in a Sinatra app I’m building. Does anyone know of work to implement these in Ruby?

1 Like

There’s a very similar set of tools for Ruby in the form of Rack and Rack::Builder.

Thanks. I’m familiar with Rack, but I’m really hoping to follow the Phoenix idioms, albeit using Ruby-based metaprogramming.

-r

What exactly are you after? Besides streaming I don’t see what Plug offers over Rack here, other then a slightly nicer API (for me).

To me, the Phoenix API is very reminiscent of Sinatra’s. And, although Sinatra doesn’t have plugs and pipelines, it seems like they could be added fairly readily (albeit using a different flavor of metaprogramming).

I’m about to do a fairly substantial architectural refactoring. This would let me try out the plug/pipeline approach in my current code base, as well as making it easier to move part or all of the server into Phoenix, if that seems worthwhile.

-r

Sinatra apps are regular Rack apps, you can compose these in more or less
the same way as plug and pipelines. Everything is already there :slight_smile: