Skip to content

Commit

Permalink
feat: add external stats api
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Dec 17, 2019
1 parent 4cf5ea3 commit d9a3fdb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/controllers/api/v1/external/stats_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Api
module V1
module External
class StatsController < ApplicationController
skip_before_action :check_header_info

def show
return if params[:id] != "tip_block_number"

render json: Block.recent.first&.number.to_s
end
end
end
end
end
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

namespace :api do
namespace :v1 do
namespace :external do
resources :stats, only: :show
end
resources :blocks, only: %i(index show)
resources :address_transactions, only: :show
resources :block_transactions, only: :show
Expand Down

0 comments on commit d9a3fdb

Please sign in to comment.