move routes logic to routes.js, move rules to rule.js