Skip to content

Commit f24e4ef

Browse files
chore: configure ktor content negotiation
1 parent 3b68f86 commit f24e4ef

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/kotlin/infrastructure/api/APIController.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88

99
package infrastructure.api
1010

11+
import io.ktor.serialization.kotlinx.json.json
1112
import io.ktor.server.application.Application
1213
import io.ktor.server.application.call
14+
import io.ktor.server.application.install
1315
import io.ktor.server.engine.embeddedServer
1416
import io.ktor.server.netty.Netty
17+
import io.ktor.server.plugins.contentnegotiation.ContentNegotiation
1518
import io.ktor.server.response.respondText
1619
import io.ktor.server.routing.delete
1720
import io.ktor.server.routing.get
@@ -27,7 +30,12 @@ class APIController {
2730
* Starts the http server to serve the client requests.
2831
*/
2932
fun start() {
30-
embeddedServer(Netty, port = 3000, module = this::dispatcher).start(wait = true)
33+
embeddedServer(Netty, port = 3000) {
34+
dispatcher(this)
35+
install(ContentNegotiation) {
36+
json()
37+
}
38+
}.start(wait = true)
3139
}
3240

3341
/**

0 commit comments

Comments
 (0)