Now, we have created the repository and service layer, and we are ready to expose our service through HTTP endpoints:
package springfive.twittertracked.domain.resource import org.springframework.web.bind.annotation.*import springfive.twitterconsumer.domain.TrackedHashTagimport springfive.twitterconsumer.domain.service.TrackedHashTagService @RestController@RequestMapping("/api/tracked-hash-tag")class TrackedHashTagResource(private val service:TrackedHashTagService) { @GetMapping fun all() = this.service.all() @PostMapping fun save(@RequestBody hashTag:TrackedHashTag) = this.service.save(hashTag)}
The code is pretty concise and simple. Take a look at how concise this piece of code is. The preceding code is an example ...