title: Making a Rack CLI
body: <p>I'm trying to make a framework similar to Rails, but purely focused on GraphQL. Once nice feature of Rails is that it provides a CLI interface and a config.ru for Rack. Therefore, you can call <code>rackup</code> or you can call <code>bin/rails server</code> and the Rails app will run. I managed to mimic this functionality by putting the Rack app into a separate file (<code>config/application.rb</code>), which I import in <code>config.ru</code> and in the CLI, then instantiate and run.</p>
  
  <p>However, I have an issue with Rack middleware. Since Rack middleware appears to just magically work when you run <code>use MyMiddleware</code> with an instantiated Rack app, I'm not really sure how I can do this in both config.ru and in my CLI. Right now it looks like I need to instantiate the app in a separate location, add the middleware, then hand it over to config.ru or the CLI. Which, I could do, but it feels like there has to be a way to attach middleware in a cleaner way. For instance, can I require config.ru in some way and then run it? Or can I attach middleware before I instantiate the app?</p>