refacting server side api with promisse (work in progress)