kemal/samples/json_api.cr
2015-10-29 11:49:58 +02:00

9 lines
260 B
Crystal

require "kemal"
require "json"
# You can easily access the context and set content_type like 'application/json'.
# Look how easy to build a JSON serving API.
get "/" do |env|
env.set_content_type = "application/json"
{name: "Serdar", age: 27}.to_json
end