creating the api to database part