Sinatra Basics : Reload Changes Without Restarting the Server
Learn to use shotgun gem to reload changes without restarting the server.
source 'https://rubygems.org' gem 'shotgun' gem 'sinatra'
If you don't specify the sinatra gem in the Gemfile you will get an error.
Install the gem:
Run the Sinatra application using shotgun gem:
bundle exec shotgun hi.rb
You will the text 'hi' in the browser.
Change the static text to:
require 'sinatra' get '/' do RUBY_VERSION end
Reload the browser. Now you don't have to restart the server every time you make changes to the code.
In this article, you learned how to use shotgun to reload changes without restarting the server.
Ace the Technical Interview
- Easily find the gaps in your knowledge
- Get customized lessons based on where you are
- Take consistent action everyday
- Builtin accountability to keep you on track
- You will solve bigger problems over time
- Get the job of your dreams
Take the 30 Day Coding Skills Challenge
Gain confidence to attend the interview