Files
2012-02-21 01:15:00 -05:00

1 line
1.3 KiB
JSON

[{"user_id": 42755, "stars": [], "topic_id": 47038, "date_created": 1319575489.408577, "message": "So, one portion of my app consists of a JSON-based content API. I found that Middleman works great for this. This is how I have it set up:", "group_id": 10410, "id": 2432287}, {"user_id": 42755, "stars": [], "topic_id": 47038, "date_created": 1319575563.8159461, "message": "Is that the best way to go about it? Is there an easier, more Sinatra-y way to get the same result (everything in /data/ gets rendered out as its own JSON)?", "group_id": 10410, "id": 2432294}, {"user_id": 42755, "stars": [], "topic_id": 47038, "date_created": 1319575524.4939389, "message": "config.rb:\ndata.to_h.each_key do |dataset|\n page \"/api/#{dataset}.json\", :layout => false, :proxy => \"/api/json.erb\", :ignore => true do\n @data_set = dataset\n end\nend\n\n/api/json.erb:\n<%= data.to_h[@data_set].to_json %>", "group_id": 10410, "id": 2432290}, {"user_id": 7586, "stars": [], "topic_id": 47038, "date_created": 1319576153.802146, "message": "With the current system, that's definitely the best way to do it. Anything more Sinatra-y wouldn't be built by MM during the build cycle. That said, it may be a good feature to add to \"mount\" the json files in data/ somewhere in the site. So take every data/*.json and make it available at /api/", "group_id": 10410, "id": 2432368}]