Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How do bonus routes interact with Statamic's GraphQL support
    Statamic Bonus Routes GraphQL API Statamic Routes SEO-Friendly URLs Content Management Statamic Addons Web Development


How do bonus routes interact with Statamic's GraphQL support


bonus routes in Statamic do not directly interact with Statamic's built-in GraphQL support. Here's a summary of how they differ:

1. Bonus Routes: The "Bonus Routes" addon allows you to define additional collection and taxonomy routes in Statamic. These routes are defined in the `routes/web.php` file using the `Route::bonus()` method. Bonus routes are primarily used to create SEO-friendly URLs and mount collections to different sections of your site.

2. GraphQL API: Statamic has built-in support for a GraphQL API, which provides a read-only API for delivering content to your frontend, external apps, SPAs, and other sources. The GraphQL API is enabled by default in Statamic 3.3+.

3. Separate Functionalities: Bonus routes and the GraphQL API serve different purposes. Bonus routes are used for URL management and routing within your Statamic application, while the GraphQL API is used for exposing your content to external systems and frontends.

4. No Direct Integration: The search results do not indicate any direct integration or interaction between bonus routes and Statamic's GraphQL API. They are separate features that can be used independently.

5. Potential Combination: While bonus routes and the GraphQL API do not directly interact, you can potentially combine them in your Statamic application. For example, you could use bonus routes to create SEO-friendly URLs for your content, and then expose that content through Statamic's GraphQL API for consumption by your frontend application or other systems.

In summary, bonus routes and Statamic's GraphQL API are separate features that serve different purposes. Bonus routes are used for URL management and routing within your Statamic application, while the GraphQL API is used for exposing your content to external systems and frontends. They can be used independently or in combination, depending on your application's requirements.

Citations:
[1] https://stackoverflow.com/questions/75373946/can-we-use-statamic-cms-as-a-backend-and-vue-with-graphql-on-the-frontend-for
[2] https://statamic.dev/graphql
[3] https://statamic.com/addons?page=2&sort=name
[4] https://statamic.com/addons/jacksleight/bonus-routes
[5] https://statamic.dev/controllers