-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rb
43 lines (34 loc) · 859 Bytes
/
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'rubygems'
require 'sinatra'
require 'redis'
require 'uri'
$redis = Redis.new
class MinStore < Sinatra::Base
set :public_folder, File.dirname(__FILE__) + '/public'
helpers do
def production?
# are we in production?
ENV['RACK_ENV'] && ENV['RACK_ENV'].strip == 'production'
end
end
get "/min-store.js" do
# serve the client js
content_type 'application/javascript'
erb : 'min-store.js'
end
get '/:key' do
# return this key's value
end
delete '/:key' do
# delete this key out of redis and mongo(?)
end
post '/:key/:value' do
# create a key and give it this value, replacing any existing key
end
patch '/increment/:key/:value' do
# modify a key and increment by this value
end
patch '/decrement/:key/:value' do
# modify a key and decrement it by this value
end
end