0

I'm currently following this tutorial (tutorial) to implement a front end on a Springboot application. I've been following along fairly well, until I got to step 3.3- namely, generating a list of clients on the react page.

**The main problem: ** I cannot display clients on the page.

Here's my understanding of how the MVC works: posting this command (curl -X POST http://localhost:8080/clients -d '{"name": "John Doe", "email": "john.doe@baeldgung.com"}') with Postman calls the PostMapping function within the controller to add a new client. The react view calls upon the list of clients and prints them on the page. This is what it should look like:

Theory as to why it's not working: I'm doing something wrong with Postman. I'm using the browser version of Postman. When I set it to a Get request it gives me a 200. When I switch this to a Post request, I get a 404. How should the request be configured? enter image description here

Additional questions: Is there a way to check that postman is working within the code? Could I put a print statement in post function of the controller to insure its working? Could I output the list of clients on http://localhost:8080/clients to double check the list? What file controls the output of http://localhost:8080/clients

reb_292_
  • 11
  • 2
  • see this link. https://stackoverflow.com/questions/27957943/simulate-a-specific-curl-in-postman – Ballo Ibrahima Mar 11 '23 at 22:59
  • I was able to successfully import the curl, however I get a 415 error – reb_292_ Mar 12 '23 at 16:46
  • I posted a question on the link above. My question: how to solve a 415 error. Is there a specific way it should be formatted? – reb_292_ Mar 12 '23 at 17:18
  • The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format. The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly. – Ballo Ibrahima Mar 12 '23 at 19:23

0 Answers0