Michael Grigoryan
12/29/2021, 5:49 AMBiDiBodyLens<T>
) to send and I guess receive JSON but isn't there any other way of sending JSON as a response in http4k except for I guess "injecting" the response? Also is there any place where I can find all the terminology used in http4k?
My code currently looks like this:
// Will be used for sending JSON encoded emoji as a response
val lensEmojiResponse: BiDiBodyLens<Emoji> = Body.auto<Emoji>().toLens()
/**
* Entrypoint of the application. We can consider
* this as the main router to which all other routes
* are attached to.
*/
val app: HttpHandler = { _: Request ->
val emoji = Emoji("Sob", "😭")
// Setting the response value. It will be already
// encoded as JSON by kotlinx.serialization
lensEmojiResponse.inject(emoji, Response(Status.OK))
}
dave
12/29/2021, 9:20 AMresponse.with(lens of value)
A glossary is probably a good idea, but we don't have a dedicated one. There are the concepts and core module reference pages however at the momentMichael Grigoryan
12/30/2021, 11:06 AM