Adding json api endpoint to the /posts and /posts/{:id} endpoints.