acorbel
acorbel

Reputation: 1568

Symfony - One route and All actions with event listeners

I am developing a platform with Symfony2 for the backend and I use to develop RestApi (with FosRestBundle).

My platform is based on modules plug-n-play. I was wondering if using event dispatcher behind one route for all actions is good ? I'm talking about performance.

What do you think about it ?

Thank you !

Upvotes: 0

Views: 39

Answers (1)

MeuhMeuh
MeuhMeuh

Reputation: 885

What do you mean about one route ? It would be better, for a performance consideration and a "clean" way to do it, to create a route for each endpoint. A route gives you tools to control how to reach it, and I strongly recommend to use it.

For your modules-based API, you could imagine registering your modules to a central modules manager. This manager would then parse them and create the routes declared in each of them, according to specific rules that you would define.

Upvotes: 2

Related Questions