summaryrefslogtreecommitdiff
path: root/scarecrow.rb
diff options
context:
space:
mode:
Diffstat (limited to 'scarecrow.rb')
-rw-r--r--scarecrow.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/scarecrow.rb b/scarecrow.rb
index a527515..71adf45 100644
--- a/scarecrow.rb
+++ b/scarecrow.rb
@@ -9,6 +9,9 @@ require 'dm-migrations'
set :public_folder, File.dirname(__FILE__) + '/public'
set :bind, '::'
+configure do
+ mime_type :text, 'text/plain'
+end
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/scarecrow.sqlite")
class Temperature
@@ -86,4 +89,11 @@ get '/humidity' do
"#{humidity}"
end
+get '/metrics' do
+ content_type :text
+ humidity = Humidity.last[:value]
+ temp = Temperature.last[:value]
+ "humidity #{humidity}\ntemperature #{temp}"
+end
+
init