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

class App < Sinatra::Base def hello "world" end end 

From the documentation, I found that I can run the application as follows:

 App.run 

Although this does not return the control.

How to run the application in the background and how can I stop it.

My environment: Windows, Ruby 1.9.2

+6
windows ruby sinatra thin
source share
2 answers

Use a config.ru file, such as Dmitry Maximov, suggested:

 #config.ru require './your_app_file' run YourApp 

And then start with rackup -D , which means deamonization and therefore it works in the background.

I would not recommend this for development. Better look Shotgun

+7
source share

Create in the top folder of your application file - config.ru - with the following contents:

 # config.ru $: << File.expand_path(File.dirname(__FILE__)) require 'your app' run Sinatra::Application 

Then just launch the application with thin start

+6
source share

All Articles