Sinatra Basics : Reload Changes Without Restarting the Server


Learn to use shotgun gem to reload changes without restarting the server.


Step 1

Create Gemfile:

source ''

gem 'shotgun'
gem 'sinatra'

If you don't specify the sinatra gem in the Gemfile you will get an error.

Step 2

Install the gem:


Step 3

Run the Sinatra application using shotgun gem:

bundle exec shotgun hi.rb

Step 4

Browse to

Step 5

You will the text 'hi' in the browser.

Step 6

Change the static text to:


like this:

require 'sinatra'

get '/' do

Step 6

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.

Related Articles

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

No spam ever. Unsubscribe anytime.