rmosolgo / graphiql-rails

Mount the GraphiQL query editor in a Rails app
MIT License
447 stars 135 forks source link

Why is rails a dependency? #37

Closed TSMMark closed 7 months ago

TSMMark commented 6 years ago

This looks just like a simple Rack app that you can mount in any Rack router. Does it work with sinatra / cuba / roda?

rmosolgo commented 6 years ago

At the time, a Rails engine was the best technique I knew. These days, I'd love to explore a rack-based alternative, see https://github.com/rmosolgo/graphql-ruby/issues/1051

As a Rails engine, this project uses Rails structure, see https://github.com/rmosolgo/graphiql-rails/tree/master/app

ryanmt commented 6 years ago

Furthermore, requiring rails itself is a bad practice, as it requires installation of often unnecessary dependencies (like actioncable, etc) for all cases. For instance, in rails 5, the API mode doesn't install those features to new apps either, but depending on this gem would bring those in.

Addressing this can be fairly simple as just replacing s.add_runtime_dependency "rails" with s.add_runtime_dependency "railties" in the gemspec gets you most of the way.

I'll push up a PR to address that.

rmosolgo commented 6 years ago

That'd be great!

rmosolgo commented 6 years ago

(dang it, wrong button!)

rmosolgo commented 7 months ago

I don't think there's any further action on this PR, so I'll close it.