getting posts from database for view