【问题标题】:Symfony2 FosRestBundle root api urlSymfony2 FosRestBundle 根 api url
【发布时间】:2015-05-11 10:46:36
【问题描述】:

为了开发我的 API,我一直在查看 FOS-Rest-Bundle 文档。问题是我希望 API 位于 api/ 下,但似乎没有任何选项可以实现这一点。

有办法吗?我该怎么做?

谢谢

【问题讨论】:

    标签: api symfony namespaces fosrestbundle


    【解决方案1】:

    您可以在路由中添加前缀。 见http://symfony.com/doc/current/book/routing.html#prefixing-imported-routes

    例如:

    api_rest:
        type: rest
        prefix: /api
        resource: "@MyBundle/Resources/config/rest_routes.yml"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-19
      • 2023-03-25
      • 1970-01-01
      • 2015-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-07
      相关资源
      最近更新 更多