summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-09-14 15:32:55 +0200
committermr <mr@mrautenberg.de>2011-09-14 15:32:55 +0200
commitb6ad14a839528beab98340beb7942a246a27037d (patch)
treeb6dd0c9df03eee5463a959c7ee06cc578f4fccba
parentccff144936f2400c745e77e012c32de4559e9b22 (diff)
fix: list jsonfiles for GET '/' call | prettify json view in html
-rw-r--r--application.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/application.rb b/application.rb
index c3520f4..8b42c8c 100644
--- a/application.rb
+++ b/application.rb
@@ -142,7 +142,7 @@ end
# Get a list of available datasets
# @return [text/uri-list] List of available datasets
get '/?' do
- uri_list = Dir["./#{@@datadir}/*yaml"].collect{|f| File.basename(f.sub(/.yaml/,'')).to_i}.sort.collect{|n| uri n}.join("\n") + "\n"
+ uri_list = Dir["./#{@@datadir}/*json"].collect{|f| File.basename(f.sub(/.json/,'')).to_i}.sort.collect{|n| uri n}.join("\n") + "\n"
case @accept
when /html/
response['Content-Type'] = 'text/html'
@@ -180,7 +180,7 @@ get '/:id' do
when /html/
response['Content-Type'] = 'text/html'
- OpenTox.text_to_html File.read(@json_file)
+ OpenTox.text_to_html JSON.pretty_generate(JSON.parse(File.read(@json_file)))
when "text/csv"
response['Content-Type'] = 'text/csv'