Skip to content

Commit fc454c8

Browse files
committed
added endpoint outside namespace to prevent 404's
1 parent 5d13976 commit fc454c8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ class SpacexAPI < Sinatra::Base
5959
# redirect request.url.sub('http', 'https') unless request.secure?
6060
# end
6161

62+
# Single endpoint outside namespace
63+
get '/' do
64+
content_type :json
65+
collection = client[:home]
66+
hash = collection.find({}, projection: {_id: 0})
67+
JSON.pretty_generate(hash.to_a[0])
68+
end
69+
6270
# Sets namespace for all following URL's
6371
namespace '/v1' do
6472

0 commit comments

Comments
 (0)