implement compare method of path

implement compare method of path
refactor the routing method

refactor the routing method