Created the getPosts and getPostById functions to handle the requests for all posts and a specific post