https://kotlinlang.org logo
#ktor
Title
# ktor
a

Alexandre Brown

08/23/2021, 12:45 PM
[SOLVED] Hello, I'm getting a 404 error when using
@Location
on Ktor 1.6.0, anybody had similar issue?
Copy code
dependencies { 
    implementation("io.ktor:ktor-locations:$ktorVersion")
}

tasks.withType<KotlinCompile> {
    kotlinOptions.freeCompilerArgs += listOf("-Xuse-experimental=io.ktor.locations.KtorExperimentalLocationsAPI")
}
Copy code
import io.ktor.locations.Location

@Location("/mylocation")
class MyLocation
Copy code
fun Application.someFun() {
    routing {
        route("/my-root") {
            post<MyLocation> {
ł

Łukasz Bednarczyk

08/23/2021, 12:51 PM
I suppose that you have an incorrect import of post method.
a

Alexandre Brown

08/23/2021, 12:52 PM
@Łukasz Bednarczyk This is possible, let me check
@Łukasz Bednarczyk Thanks a lot, you were right, I was importing
import <http://io.ktor.routing.post|io.ktor.routing.post>
instead of
import <http://io.ktor.locations.post|io.ktor.locations.post>
ł

Łukasz Bednarczyk

08/23/2021, 12:59 PM
that I thought 😉
😄 1
2 Views