Removing routes: necessary functionality?


#1

Recently, a user raised a question regarding documenting the removal of routes in Sanic.

Following @sjsadowski request, I’m creating here a discussion regarding this item.

IMO, I don’t think we need such feature inside Sanic. The first question regarding this is why having to remove a route a feature anyway? You just don’t need to create it. Let me elaborate more regarding some different perspectives.

Complexity

As most of us know, the Sanic router itself is already rather complex, with a lot of different set of rules for dynamic routes, static routes, versioned routes, optional strict slashes and so on. Now, add to the mix the ability to group and nest blueprints. Yes, route creation rules became complex as well.

So, imagine the following scenario: deleting a route from a nested blueprint that was created using the version argument. Yummy.

State management

Ok, now the second problem in case you want to remove a route: how to provide a proper state management in your deploy, if you have the possibility to scale your application, vertically and horizontally? route.remove("/top-secret") will have to be orchestrated between all running workers, or else we might end up with an issue saying “Remove routing [doesn’t work | works partially] in production”, stating that “all tests works fine in the development environment”. Blame on us for providing such functionality without thinking about all possible caveats the user might find way further down the road.

A very similar question was made in another issue, just as a heads up.

Wrapping up

As long as I want to provide happiness to all Sanic users, I must say that some things are just too off hand to contemplate the full aspect of the word “solution”, thus questioning if this functionality should stay at Sanic.

Let me know your thoughts.

My best regards,
Richard.


#2

I don’t think removing routes is necessary and would propose we deprecate the feature in 18.12 and remove for 19.X


#3

Yeap, I think this might work as is the logical thing to do: deprecate and remove :+1: