💥 Poste innmeldte feil til backend

Co-authored-by: Sindre Kjelsrud <sindre.kjelsrud@nav.no>
Co-authored-by: Amalie Mansåker <amalie.erdal.mansaker@nav.no>
This commit is contained in:
Markus Johansen 2023-07-05 14:17:57 +02:00
parent e49bce0470
commit 4ad4ce0a75
5 changed files with 59 additions and 21 deletions

View file

@ -0,0 +1,13 @@
package no.nav.helse.sprik
import kotlinx.serialization.Serializable
@Serializable
data class Feil(
val tittel: String,
val beskrivelse: String,
) {
override fun toString(): String {
return "Feil(${tittel}\n${beskrivelse})"
}
}

View file

@ -8,6 +8,7 @@ import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.plugins.cors.routing.*
import io.ktor.server.request.*
import no.nav.helse.sprik.Feil
import no.nav.helse.sprik.Test
fun Application.configureRouting() {
@ -26,6 +27,10 @@ fun Application.configureRouting() {
}
post("/test") {
val test = call.receive<Test>()
call.respond(status = HttpStatusCode.Created, message = test)
}
post("/nyFeil"){
val test = call.receive<Feil>()
println(test)
call.respond(status = HttpStatusCode.Created, message = test)
}