working api and database. Api needed to be moved globaly to work