Updated: Sep 11, 2021
Routes are meant to reach a Cloud native application hosted in Cloud platform like Cloud Foundry. Routes are created and assigned to a cloud foundry application when an application is deployed in Cloud Foundry for the first time. Routes are the fully qualified paths of the application which is a unique name and domain to reach the application. The routes are used as the base URL of an application. One application can be assigned multiple routes.
$ cf routes
This command returns all active routes that exist for all applications in the current space. It shows the space, hostname, domain, path and any application or service bound to the route.
When you delete your application the route is not automatically deleted.
So the -r option in the cf delete instructs to delete the routes associated with the application, otherwise we can find the orphan routes using cf routes command and delete them. The orphan routes will not have any associated application or service.
We can use the below command to delete routes
cf delete-route <domainName> --hostname <hostName>
<domainName> and <hostName> is the domain and hostname of the application or micro service you would like to delete the route.
In cloud native application development, generally a lot of micro service runs as a set, each responsible for a specific task. Each micro service with a different name but all of them with the same domain.