mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-27 10:08:11 +08:00
Add health check endpoint to API controller [SCI-1970]
This commit is contained in:
parent
73b56beae9
commit
28be7c4fc4
2 changed files with 8 additions and 3 deletions
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue