2015-10-23 19:25:46 +00:00
|
|
|
require "kemal"
|
|
|
|
require "json"
|
|
|
|
|
2015-10-29 09:49:58 +00:00
|
|
|
# You can easily access the context and set content_type like 'application/json'.
|
2015-10-23 19:25:46 +00:00
|
|
|
# Look how easy to build a JSON serving API.
|
|
|
|
get "/" do |env|
|
2016-01-29 11:31:00 +00:00
|
|
|
env.response.content_type = "application/json"
|
2015-10-23 19:25:46 +00:00
|
|
|
{name: "Serdar", age: 27}.to_json
|
|
|
|
end
|