-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathplanet.rb
51 lines (43 loc) · 1.05 KB
/
planet.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
44
45
46
47
48
49
50
51
require 'rack/cache'
require 'sinatra'
require 'builder'
require 'rabl'
require 'raven'
require 'sinatra/cross_origin'
require './feeds'
configure do
enable :cross_origin
end
configure :production do
Raven.configure do |config|
config.dsn = ENV['SENTRY_DSN']
config.excluded_exceptions = ['Sinatra::NotFound']
end
use Raven::Rack
use Rack::Cache,
:metastore => 'file:tmp/cache/meta',
:entitystore => 'file:tmp/cache/entity',
:verbose => true
end
Rabl.configure do |config|
config.escape_all_output = true
config.include_json_root = false
config.enable_json_callbacks = true
config.include_child_root = true
end
get '/', :provides => 'html' do
redirect 'https://github.com/codatory/indyhackers.org-planet'
end
get '/posts.rss' do
cache_control :public, :max_age => 3600
@posts = Feeds.to_a
builder :feed
end
get '/posts.json', :provides => 'html' do
redirect 'https://github.com/codatory/indyhackers.org-planet'
end
get '/feeds.opml' do
cache_control :public, :max_age => 3600
@feeds = Feeds.feed_meta
builder :opml
end