2

I want to accept multiple routes in a single method.

resource :mypath do
  helpers do
    def mymethod
      super_duper_stuff
    end
  end

  post do
    something_else
  end

  get do
    mymethod
  end

  resource :subpath
    post do
      mymethod
    end
  end
end

Is there any way to combine a GET to /mypath and a POST to /mypath/subpath so I can put the code into the route method and not in the helpers section? Something like this:

resource :mypath do
  post do
    something_else
  end

  get, route(['POST'], "subpath") do
    super_duper_stuff
  end
end
Joe
  • 41,484
  • 20
  • 104
  • 125
user433342
  • 859
  • 1
  • 7
  • 26
  • The other solution won't work for my situation, I want the subpath to accept a post and do the same method as a get to the base path. A post to the base path does a completely different method. The solution you marked as dupe will not work for my request. – user433342 Mar 02 '18 at 16:06

0 Answers0