add onBeforeRoute for handler