Loading...

Questions tagged [rest-api]

Representational State Transfer Application Programming Interface

4 questions with this tag
44
votes
2
answers
Best way to handle exceptions globally in Spring Boot REST API?

I want to handle all exceptions in one place in my Spring Boot application instead of using try-catch in every controller method. What's the best pra...

asked by java_master 4 days ago
41
votes
2
answers
How to validate request body in Spring Boot REST API?

I'm building a REST API and need to validate the request body. I have a UserDTO class: ```java public class UserDTO { private String email; p...

asked by java_master 5 days ago
52
votes
3
answers
How to enable CORS in Spring Boot for my React frontend?

I have a Spring Boot backend running on localhost:8080 and a React frontend on localhost:3000. When I try to make API calls from React, I get: ``` Ac...

asked by spring_guru 1 week ago