(1) Implement code that satisifes the following request / response pattern.
# request: GET '/matt'
# response: "Hello matt. Do you mind if I call you ttam?"
# your code here
(2) Implement code that satisfies the following request / response pattern.
# request: GET to '/add?x=40&y=2'
# response: "42"
# your code here
(3)
Describe in words what the following code will do after a GET request to '/'
require 'sinatra'
get '/' do
redirect '/hot'
end
get '/hot' do
redirect '/potato'
end
get '/potato' do
redirect 'http://google.com'
end
# your words can go here.
(4)
Assuming a static image of a lemur exists in a public
folder as lemur.png
and the following server.rb
...
#server.rb
get '/lemur.png' do
"I am a Lemur. Feed me rice."
end
What will be the response to a `GET request to '/lemur.png'?
# your answer goes here
(5)
What will be the response to a GET request to '/fun_times/4'
require 'sinatra'
get '/*' do
"sup tho"
end
get '/fun_times/:num' do
"fun " * params[:num]
end
# your answer here