user2630970
user2630970

Reputation: 153

Webrick does not start when starting a Sinatra app

Any idea why Webrick refuses to start?

require 'sinatra/base'
require 'slim'

class Blog < Sinatra::Base
  get '/' do
    slim :home
  end
end

Running ruby blog.rb does nothing. No error is raised.

Upvotes: 0

Views: 479

Answers (1)

matt
matt

Reputation: 79733

The built in web server isn’t started when using the modular style of Sinatra apps. See the docs for the differences between modular and classic styles.

To get it to run like a classic style app, add this line to the bottom of your Blog class:

run! if app_file == $0

Upvotes: 1

Related Questions