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

andylamax

04/30/2021, 6:19 PM
Hi fella, hope you are doing good. So, I have the following configuration in my server
Copy code
routing {
  get("/") {
    // this works as expected
  }

  static("/") {
    // I have this as well
  }

  //and
  get("/config/{file}") {
    // overridden by static("/")
  }
}
Question is, how do I implement both
static("/")
overriding my
get("/config/{file}")
. With both of them existing, ,aking a get request to
/config/user1
returns not fount. I am assuming it is looking to the files served as static resources. Help?
r

Robert Jaros

04/30/2021, 7:31 PM
Change the order - define static at the end.
r

Rustam Siniukov

04/30/2021, 7:49 PM
a

andylamax

05/01/2021, 7:24 PM
@Robert Jaros Thanks for your suggestion, however as @Rustam Siniukov pointed out, The order did not matter a lot with ktor 1.5.3, downgrading to 1.4.3, and putting static at the end solved the problem. Thank you all for your support
After playing a bit with different versions of ktor, I have seen it to be working as expected upto ktor verision 1.5.0. ktor 1.5.1-1.5.3 breaks and doesn't properly resolve this
3 Views