Latest Update
Reloading Grape::API applications in development
Grape::API1 is an awesome tool for building APIs in Ruby – it’s quick 2 and has a nice DSL with some lovely features. One major issue with it comes whilst developing the application – there is no built in reloading of classes, and whilst there are a couple of threads about implementing reloading3, there’s no progress as yet.
Fortunately, Grape is Rack-based, which allows us to use Shotgun4 as a development server, which handles reloading for us. Simply add a
|
1 2 3 |
group :development do
gem 'shotgun'
end |
to your Gemfile to give yourself a copy of Shotgun in development mode, run
|
1 |
$ bundle install |
and then you’ll be able to start your app by running
|
1 |
$ shotgun |
Visit http://localhost:9393/[your path here], make some changes and refresh to see your changes working, and a major headache gone!
Recent Comments