Add health check endpoint to API controller [SCI-1970]

This commit is contained in:
Oleksii Kriuchykhin 2018-01-22 16:52:48 +01:00
parent 73b56beae9
commit 28be7c4fc4
2 changed files with 8 additions and 3 deletions

View file

@ -4,9 +4,9 @@ module Api
attr_reader :token
attr_reader :current_user
before_action :load_token, except: %i(authenticate status)
before_action :load_iss, except: %i(authenticate status)
before_action :authenticate_request!, except: %i(authenticate status)
before_action :load_token, except: %i(authenticate status health)
before_action :load_iss, except: %i(authenticate status health)
before_action :authenticate_request!, except: %i(authenticate status health)
rescue_from StandardError do |e|
logger.error e.message
@ -24,6 +24,10 @@ module Api
@iss = nil
end
def health
render plain: 'RUNNING'
end
def status
response = {}
response[:message] = I18n.t('api.core.status_ok')

View file

@ -482,6 +482,7 @@ Rails.application.routes.draw do
end
namespace :api, defaults: { format: 'json' } do
get 'health', to: 'api#health'
get 'status', to: 'api#status'
post 'auth/token', to: 'api#authenticate'
scope '20170715', module: 'v20170715' do