Hi :wave: does someone has a best practice for sh...
# ktor
t
Hi 👋 does someone has a best practice for sharing code between ktor server and multiplatform client?
all the things 1
d
I don't know about any best practice. I personally use gradle sub-projects, one being a multi-platform library with my
@Serializable
definitions and shared code. I make sure it has the required targets for my server and clients.
👍 2
c
I'm doing the same, full project here: https://gitlab.com/arcachon-ville/formulaide
api
is shared,
client
has the Ktor client,
server
has the Ktor server.
💯 1
h
I do share the API (client) too:
fun API(client: HttpClient)…
. In the server test, you can use its mock client to test the API too, and ensure using the same „real“ api functions defined in your shared module.
c
That's a nice idea.