getAllPosts now retrieves posts from database