added mongoose configuration and decoupled routing