💥 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:
parent
e49bce0470
commit
4ad4ce0a75
5 changed files with 59 additions and 21 deletions
13
backend/src/main/kotlin/no/nav/helse/sprik/Feil.kt
Normal file
13
backend/src/main/kotlin/no/nav/helse/sprik/Feil.kt
Normal 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})"
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
|
|
Reference in a new issue