Using the Route attribute in an ASP.NET Core Web API

The Route attribute allows for routing Web API and MVC controllers in ASP.NET Core.

It contains a template parameter that allows you to add a parent route for the controller.

Take this VehicleApiController:

[ApiController]
public class VehicleApiController : ControllerBase
{
	[HttpGet("my-vehicle")]
	public IActionResult MyVehicle()
	{
		return Ok("Ford");
	}
}

The MyVehicle action is called using the HTTP GET method with a route of my-vehicle.

If we wanted to prepend /api/vehicle to the route so the action will render from /api/vehicle/my-vehicle, how could we do that with the Route attribute added to the controller?