Code or method which is always called/triggered

Hi All,
Is there any trigger or api which is called at every action in erpnext. In my case I want a trigger on route change, but it will not be same route every time. So is there any piece of code or validation which is triggered every time or always.

Please guide me if there is a solution.

Thanks

@Sagarika_Mohan_Naik doc_events in hooks.py may help you.

doc_events = {
    "*": {
        # will run after any DocType record is inserted into database
        "after_insert": "app.crud_events.after_insert_all"
    }
}

https://frappeframework.com/docs/v13/user/en/python-api/hooks#crud-events

Thanks @jamsheer
I dont want a doc event. What exactly I want is a trigger when a route is changed.
Eg: I am in http://localhost:8000/app and I want a trigger when a user routes to http://localhost:8000/app/home/*

It would be helpful if you can guide me on this.

Thanks