We are trying to implement the no.of request to the API using below syntax from the documentation for our API handler
val app = Javalin.create {
it.defaultContentType = "application/json"
it.enableWebjars()
it.addStaticFiles("", Location.CLASSPATH)
it.enableCorsForAllOrigins()
it.dynamicGzip = true
}
app.options("/*") { ctx -> ctx.status(405) }
app.get("/*"){ctx ->
RateLimit(ctx).requestPerTimeUnit(5, TimeUnit.MINUTES) // throws if rate limit is exceeded
ctx.status("Hello, rate-limited World!") }
But end up getting unresolved reference Ratelimit error. any pointers with the syntax here?
We are using Kotlin to implement it.