From the course: Creating Your First Spring Boot Microservice

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Declaring a new RestController

Declaring a new RestController

From the course: Creating Your First Spring Boot Microservice

Start my 1-month free trial

Declaring a new RestController

- So Explore California sent us some new requirements. They would like us to allow their travelers to rate tours on the website and let potential travelers see the average score for a tour. So let's look at these five use cases. First, rate a tour. Note that a traveler has a unique customer ID. Modify a tour. Again, a traveler has a unique customer ID. The next use case, view all ratings. Customer ID is not needed here. And now, the view average score use case. The customer ID is not needed here either. And finally, expected response codes to various scenarios. So a 201 should be returned when a rating is created, a 400 whenever a bad data is passed in on the APIs, and then a 404 if it's an invalid tour ID. In the exercise files, I want to show you the JPA entity and spring data repositories I've already implemented. When we start any design, we must first identify the nouns in the use cases. So the use case nouns…

Contents