Skip to content

Commit

Permalink
Updating the logic of how the class works with the application (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonovk authored May 18, 2024
1 parent 9e2514c commit 11cd251
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.6
v1.1.1
16 changes: 11 additions & 5 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,39 @@ class Application < Sinatra::Base
pass if request.path == '/healthz'

halt 403 unless request.env['HTTP_AUTHORIZATION'] == AUTH_TOKEN

@controller = ClientsController.new
end

get '/clients' do
ClientsController.new.index
controller.index
end

get '/clients/:id' do
ClientsController.new.show(params['id'])
controller.show(params['id'])
rescue Errors::ConfigNotFoundError
halt 404
end

delete '/clients/:id' do
ClientsController.new.destroy(params['id'])
controller.destroy(params['id'])
rescue Errors::ConfigNotFoundError
halt 404
end

post '/clients' do
status 201
ClientsController.new.create(params)
controller.create(params)
end

get '/healthz' do
{
status: 'ok',
version: File.read('VERSION')
version: File.read('VERSION').gsub('v', '')
}.to_json
end

private

attr_reader :controller
end

0 comments on commit 11cd251

Please sign in to comment.