I want create API which has same URL say http://stackoverflow.com/profile but having different request method like POST, PUT, GET, etc. I want to do different action based on method type. One way is write common action which for comparing methods and redirect using
$this->forward('anotherModule','anotherAction');
Is there any other way to check it’s method and redirect to different actions without using one general action?
In your
routing.ymlyou can define different controllers for the same pattern based on request methodOr if you use annotations: