routing in symfony 4

一个人想着一个人 提交于 2020-01-05 08:01:29

问题


I want to routing for my app and api like this:

app:
    resource: ../src/Controller
    type: annotation
    prefix: /

api:
    resource: ../src/Controller/Api
    type: annotation
    prefix: /api

Q1: Where should I write this? in config/routes/annotations.yaml or config/routes.yaml.

Q2: what is different between this two file and which one is used for?


回答1:


The file config/routes/annotations.yaml was probably created by a flex when applying annotations recipe. I am not 100% sure, but when you want to delete the annotations bundle it will also remove this file.

But it makes sense to me to put all annotation route imports into config/routes/annotations.yaml file, because they just depend on this package.

Other routes you should put into the config/routes.yaml file.



来源:https://stackoverflow.com/questions/49650592/routing-in-symfony-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!