- Hands-On Serverless Applications with Kotlin
- Hardik Trivedi Ameya Kulkarni
- 64字
- 2025-02-26 15:24:31
Handler
A typical RequestHandler looks like below:
package com.packt.serverless.kotlin.greeter
import com.amazonaws.services.lambda.runtime.Context
import com.amazonaws.services.lambda.runtime.RequestHandler
class Handler:RequestHandler<String,String> {
override fun handleRequest(input:String, context:Context):String {
return "Hello, $input from Kotlin"
}
}
Few points to note about the preceding code:
- With the above structure the handler that should be configured becomes com.packt,serverless.kotlin.greeter.Handler::handleRequest
- The handler is configured so that it receives a string object and returns a string object