Sinatra: Matching routes with or without trailing slashes
I felt compelled to post this as it took me more than a few minutes to figure this one out. Sinatra treats URLs with/without trailing slashes differently unless you append “/?” to the end of your route like so:
get "/test/?" do 'in test' end
The route specified above will match both “/test” and “/test/”.