Is it possible to create a route and when the route is visited/hit then a whitelist function should execute,
just like how we do in MVC architecture frameworks like django,express where we will define routers and controllers
when the route is hit then the controller which is assigned to the route will execute
how can we do that in frappe?
You can create a page in frappe that will create desired route you want, On its python code you can call your whitelist method.
If you want public or unauthenticated user on route then you can create web page, this also works similar
https://docs.erpnext.com/docs/user/manual/en/web-page