We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Creating a Simple REST API

So I am trying to create a API for my ReactJS website.

I searched on Google to find the tutoriel "Creating a Simple REST API"

However, I have ALOT of diffrent routes, and it seems like alot of code to put like 50 routes into the index file.

Is there any other way to structur the code, so that i have to have a file for every section, like "Posts" and "Pages" So "/api/posts" and "/api/pages"

Hope you understand!

In medium applications you can organize handlers in controllers.

https://docs.phalcon.io/en/3.4/application-micro#routing-handlers-controllers