-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstorage.rb
37 lines (27 loc) · 867 Bytes
/
storage.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
require 'sinatra'
require 'yajl/json_gem'
configure do
mime_type :javascript, 'text/javascript'
end
get '/' do
content_type :javascript
data = {query:
[{ id: "ga-3475", name: "gadget", price: "$6.99", cost: "$5.99" },
{ id: "sp-9980", name: "sprocket", price: "$3.75", cost: "$3.25" },
{ id: "wi-0650", name: "widget", price: "$4.25", cost: "$3.75" }]
}.to_json
end
get '/test' do
content_type :javascript
data = {query:
[{ id: "ga-3475", name: "gadget", price: "$6.99", cost: "$5.99" },
{ id: "sp-9980", name: "sprocket", price: "$3.75", cost: "$3.25" },
{ id: "wi-0650", name: "widget", price: "$4.25", cost: "$3.75" }]
}.to_json
end
get '/location' do
{name: 'Billings', location: '45.7833N, 108.5000W'}.to_json
end
post '/locaiton' do
'Success!'
end