split out db creation code; export db function to persist user
clean up routes file a bit