Posts

Showing posts with the label routing

Symfony Application Using Routing

Sample of how to use routing in a Symfony web application. The main meaning of these sample is in the configuration and routing settings, and not in the business logic, so the actions in the controllers have pseudo-code as comments. The API describes features of a product catalog in an online store. List of entities that are used in this API: Category Product Review Entities don't really exist, only controllers and actions are designed. The routing configuration for the controllers: # /config/routes.yaml controllers: resource: ../src/Controller/Catalog type: attribute prefix: '/catalog' name_prefix: 'catalog_' trailing_slash_on_root: false This means that the routes for all controllers in the src/Controller/Catalog directory will be prefixed with /catalog , so this prefix can be omitted in the controllers. The /catalog prefix is needed to separate the catalog section with products from other sections of the site such a...