Call Controller action by route


#1

Hi, is it possible by Adonis to do something like that?

Route.get('/catalog/*****, 'CatalogController.*****')

And call controllers actions with one line in routes?
e.g. when user go to /catalog/sales it calls 'CatalogController.sales', and when user call 'catalog/hidden' it calls 'CatalogController.hidden'.

In old version of Laravel it was very handy, but after it they drop it with words “Use CRUD everytime”.

Thank you!


#2

Hey @deromanenko! :wave:

Have you checked the documentation?
https://adonisjs.com/docs/4.1/routing


#3

Yes, and find only info about binding CRUD routes to Controllers :frowning:

As I said, I want to make one route that handle all actions in controller, like that:
https://laravel.com/docs/4.2/controllers#implicit-controllers


#4

Hey, @deromanenko, I think you can use Wildcard Route