问题
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