Created REST api to get stats from database