Adding js to the route logic