Skip to content

pedro/sinatra-whoami

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sinatra Whoami

Extension that adds the original route signature to the sinatra.route env so that you can log it for better endpoint-specific metrics, monitoring and alerting.

In future versions of Sinatra (possibly 1.5 and above) this will be built-in.

Usage

require "sinatra/whoami"

class MyApplication < Sinatra::Base
  register Sinatra::Whoami

  after do
    log route: env["sinatra.route"] # ie "/products/:id/photos"
  end
end

License

Released under the MIT License.

About

Thanks Konstantin Haase for the support.

About

Sinatra extension to give routes their own path

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages