I am developing a small ktor application using Fre...
# ktor
l
I am developing a small ktor application using Freemarker to render HTML-pages, which works as expected. But, I also need to set up a few API endpoints which serve JSON data to the client. To that end I install ContentNegotion with JSON serializer. It works splendidly and JOSN is produced by the api. But, now when I try one of the Freemarker pages I get:
Copy code
2022-09-02 14:38:46.137 [eventLoopGroupProxy-4-1] ERROR Application - Unhandled: GET - /tak/6/producers
kotlinx.serialization.SerializationException: Serializer for class 'FreeMarkerContent' is not found.
Mark the class as @Serializable or provide the serializer explicitly.
How can I solve that so that my server both can support Freemarker pages and JSON responses?
r
You can add plugins like content negotiation to specific subroutes.
l
I see. Great, thank you!