Refactor esp/config route