diff --git a/Gemfile b/Gemfile index 63415039..38c0cc8e 100644 --- a/Gemfile +++ b/Gemfile @@ -2,11 +2,12 @@ source 'https://rubygems.org' ruby '3.0.2' -gem 'sinatra' +gem "sinatra", "~> 2.2" group :test do gem 'capybara' gem 'rspec' + gem "webrick", "~> 1.7" gem 'simplecov', require: false gem 'simplecov-console', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index b5673894..d4e0714b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,7 +30,7 @@ GEM public_suffix (4.0.6) racc (1.5.2) rack (2.2.3) - rack-protection (2.1.0) + rack-protection (2.2.0) rack rack-test (1.1.0) rack (>= 1.0, < 3) @@ -73,15 +73,16 @@ GEM terminal-table simplecov-html (0.12.3) simplecov_json_formatter (0.1.3) - sinatra (2.1.0) + sinatra (2.2.0) mustermann (~> 1.0) rack (~> 2.2) - rack-protection (= 2.1.0) + rack-protection (= 2.2.0) tilt (~> 2.0) terminal-table (3.0.1) unicode-display_width (>= 1.1.1, < 3) tilt (2.0.10) unicode-display_width (1.6.1) + webrick (1.7.0) xpath (3.2.0) nokogiri (~> 1.8) @@ -95,7 +96,8 @@ DEPENDENCIES rubocop (= 1.20) simplecov simplecov-console - sinatra + sinatra (~> 2.2) + webrick (~> 1.7) RUBY VERSION ruby 3.0.2p107 diff --git a/app.rb b/app.rb index 4abb71ec..e23ba10c 100644 --- a/app.rb +++ b/app.rb @@ -1,8 +1,26 @@ require 'sinatra/base' + class RockPaperScissors < Sinatra::Base get '/test' do 'test page' end + get '/' do + "Hey Hey!" + erb(:index) + end + + post '/enter-name' do + "Hey Hey!" + @name = params[:name] + erb(:names) + end + + get '/names' do + p params + @name = params[:name] + erb(:names) + end + run! if app_file == $0 end diff --git a/config.ru b/config.ru index a33b6bb0..2ed615f7 100644 --- a/config.ru +++ b/config.ru @@ -1,2 +1,3 @@ require_relative './app' -run RockPaperScissors + +run RockPaperScissors \ No newline at end of file diff --git a/views/index.erb b/views/index.erb new file mode 100644 index 00000000..ac92d03e --- /dev/null +++ b/views/index.erb @@ -0,0 +1 @@ +