I have an async_sinatra application that uses eventmachine in the following way:
aget '/test' do
EM.defer { body 'test: ' + params[:foo] }
end
When I request the url as /test?foo=bar it yields test: bar, however when I declare the path as aget '/test/:foo' do and attempt to use params[:foo] the request never returns.
Why can’t I use in-url parameters in async_sinatra?
Yes but you need to declare your route like this:
More info on this here:
http://www.sinatrarb.com/intro#Routes
(search for ‘Route parameters’)