Created a api module that contains db calls shared by webrequest and websocket