Drill 21: Real project — A Spring Boot API
Connect this example to a real project you could build.
What you will be able to do
- Connect this example to a real project you could build.
Practice task
Connect this example to a real project you could build.
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/lessons")
public class LessonController {
private final LessonService service;
public LessonController(LessonService service) {
this.service = service;
}
@GetMapping
public List<Lesson> list() {
return service.published();
}
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public Lesson create(@RequestBody LessonInput input) {
return service.create(input);
}
}Your turn
EasyWrite your answer
Connect this example to a real project you could build.
TEXT · starter
Your answer…Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.