I\'m interviewing for a front-end developer job and have been given a coding test to build a simple front-end interface. I\'ve been given the server, which has been written in
Sinatra is a simple and lightweight web server. The general idea is that you write response routes like this:
get '/api' do
"Hello world"
end
When you make a HTTP GET request to yoursite.com/api you will get a "Hello world" as response.
Now to add the header you want, this should do the trick:
get '/api' do
response['Access-Control-Allow-Origin'] = '*'
"Hello world"
end