How to start and stop a Sinatra application using Thin on Windows?

Prakash Raman picture Prakash Raman · Feb 22, 2011 · Viewed 12.5k times · Source
class App < Sinatra::Base
  def hello
    "world"
  end
end

From documentation I found that I can start the application like this:

App.run

Although this does not return the control.

How do I start the application in the background and how can I then stop it.

My environment is: Windows, Ruby 1.9.2

Answer

scable picture scable · Mar 31, 2011

Use a config.ru file like Dmitry Maksimov suggested:

#config.ru
require './your_app_file'

run YourApp

And then start with rackup -D which means deamonize and therefore it runs in the background.

I wouldn't recommend this for development though. Better have a look at Shotgun