In this tutorial, you will learn how to create a Umbraco component that enabled attribute routing. Attribute routing is useful if you want to create a custom API within Umbraco and you want to have more control over the URL that the front-end will use to access it. Be default any API that uses inherits from UmbracoApiController will need to follow this URL structure:

To enable attribute routing you will need to configure Umbraco using a component. This component will need to be registered using a composer. The component code will look like this:

The composer will look like this:

In a controller you can then use the route attribute like this:

Happy coding!