tools/hello.rb in nyara-0.0.1.pre.6 vs tools/hello.rb in nyara-0.0.1.pre.8

- old
+ new

@@ -1,23 +1,28 @@ -require_relative "../lib/nyara" +require_relative "../lib/nyara/nyara" # require "open-uri" # require "pry" configure do # set :env, 'production' - # set :workers, 2 + # set :workers, 3 + map '/', 'my' end -get '/' do - # open 'http://baidu.com', &:read - send_string 'hello world' -end +class MyController < Nyara::Controller + get '/' do + send_string 'hello world' + end -get '/exit' do - exit -end + get '/exit' do + exit + end -get '/redi' do - redirect '/' + get '/redi' do + redirect '/' + end end + +Nyara.setup +Nyara.start_server # GC.stress = true