Sha256: 7961bf6d8d79797cfc62f103472b387bfb9ef42edbfc66a86f705b6bad69f4fe
Contents?: true
Size: 456 Bytes
Versions: 1
Compression:
Stored size: 456 Bytes
Contents
require 'json' require 'punky_brewster' module PunkyBrewster class Server def call(env) headers = { 'Content-Type' => 'application/json' } begin body = BeerRepository.list.to_json status = 200 rescue => error body = JSON.generate(error: "#{error.class}: #{error}") status = 500 end [status, headers, [body]] end def self.call(env) self.new.call(env) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
punky_brewster-1.3.2 | lib/punky_brewster/server.rb |