You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val dataModule = module {
single {
HttpClient {
install(ContentNegotiation) {
json(Json { ignoreUnknownKeys =true }, contentType =ContentType.Any)
}
}
}
singleOf(::PhotographerAPI)
}
val koinAppApplication:KoinAppDeclaration= {
modules(dataModule)
}
If i want to test my API directly in the main method, is that possible ?
suspendfunmain() {
val photographerAPI:PhotographerAPI=GETMYINSTANCEHEREprintln(photographerAPI.loadPhotographers().joinToString(separator ="\n\n"))
}
classPhotographerAPI(valclient:HttpClient) {...}
Could someone explain how to properly retrieve and use my PhotographerAPI instance in the main function?
by inject() and get() not working with this 3 library
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there,
I'm working on a Kotlin Multiplatform Compose project using Koin for dependency injection.
I have set up my modules as follows:
If i want to test my API directly in the main method, is that possible ?
Could someone explain how to properly retrieve and use my PhotographerAPI instance in the main function?
by inject() and get() not working with this 3 library
Thanks in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions