Sha256: 11c3f04dbc9dccd330f5c4ef315a7c3625d1535cb5bdc98edbed28808b55adbc
Contents?: true
Size: 721 Bytes
Versions: 1
Compression:
Stored size: 721 Bytes
Contents
require 'sinatra' require 'json' module Riedi class Server < Sinatra::Base def initialize(options = {}) @storage = Storage.new(options) super end get '/' do 'Riedi (try /status)' end get '/status' do @storage.status end get '/keys' do @storage.keys.to_json end post '/store/:key' do @storage.set(params[:key], params[:value]) end get '/store/:key' do value = @storage.get(params[:key]) if value value else error 404 end end delete '/store/:key' do count = @storage.del(params[:key]) if count > 0 count.to_s else error 404 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
riedi-0.0.1 | lib/riedi/server.rb |