mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 13:14:29 +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 :token
|
||||||
attr_reader :current_user
|
attr_reader :current_user
|
||||||
|
|
||||||
before_action :load_token, except: %i(authenticate status)
|
before_action :load_token, except: %i(authenticate status health)
|
||||||
before_action :load_iss, except: %i(authenticate status)
|
before_action :load_iss, except: %i(authenticate status health)
|
||||||
before_action :authenticate_request!, except: %i(authenticate status)
|
before_action :authenticate_request!, except: %i(authenticate status health)
|
||||||
|
|
||||||
rescue_from StandardError do |e|
|
rescue_from StandardError do |e|
|
||||||
logger.error e.message
|
logger.error e.message
|
||||||
|
@ -24,6 +24,10 @@ module Api
|
||||||
@iss = nil
|
@iss = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def health
|
||||||
|
render plain: 'RUNNING'
|
||||||
|
end
|
||||||
|
|
||||||
def status
|
def status
|
||||||
response = {}
|
response = {}
|
||||||
response[:message] = I18n.t('api.core.status_ok')
|
response[:message] = I18n.t('api.core.status_ok')
|
||||||
|
|
|
@ -482,6 +482,7 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :api, defaults: { format: 'json' } do
|
namespace :api, defaults: { format: 'json' } do
|
||||||
|
get 'health', to: 'api#health'
|
||||||
get 'status', to: 'api#status'
|
get 'status', to: 'api#status'
|
||||||
post 'auth/token', to: 'api#authenticate'
|
post 'auth/token', to: 'api#authenticate'
|
||||||
scope '20170715', module: 'v20170715' do
|
scope '20170715', module: 'v20170715' do
|
||||||
|
|
Loading…
Add table
Reference in a new issue