0
I didn’t even want to go to Stack in such a simple problem, but it’s already dragging on for days and I managed to implement the GET method with a certain ease, I’m learning Kotlin and java, I’m not able to implement the POST method, I’ve already tested in POSTMAN the GET and returned ok, but wanted to include the POST method to add "NEW BOOKS, AUTHORS AND PUBLISHERS", I tried several sentences, but being a beginner I am very lost.
package com.example.blog
import org.springframework.web.bind.annotation.*
data class Relatorio(
val titulo: String,
val autor: String,
val serie: String
)
@RestController
@RequestMapping("/bradesco")
class BradescoController {
@GetMapping()
public fun relatorio(): Relatorio {
val result = Relatorio(
"Bradesco Prime, O Comeco",
"Luis Carlos",
"Coletanea Bradesco"
)
return result
}
@PostMapping
@RequestMapping("/bradesco")
public fun relatorio2() {
"titulo" = "A historia de Luis Carlos"
return "Atualizado";
}
}