-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
40 lines (32 loc) · 932 Bytes
/
app.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
require 'sinatra/base'
require 'sinatra/namespace'
require_relative './helpers/validator.rb'
require_relative './helpers/responses.rb'
require_relative './helpers/errors.rb'
require_relative './helpers/error_handler.rb'
require_relative './helpers/sessions.rb'
require_relative './helpers/auth.rb'
require_relative './lib/udeg.rb'
class App < Sinatra::Base
register Sinatra::Namespace
register APIUtils::ErrorHandler
helpers APIUtils::Auth
helpers APIUtils::Validator
helpers APIUtils::Responses
def self.register_routes!(&block)
namespace '/api/v1' do
instance_eval(&block)
end
end
configure do
set :show_exceptions, false
set :raise_errors, false
set :dump_errors, false
set :logging, false
Sessions.configure!(secret: ENV['SESSION_SECRET'], algorithm: ENV['SESSION_ALGORITHM'])
end
end
# Load routes from path below
for file in Dir['./api/*.rb'] do
require(file)
end