
上QQ阅读APP看书,第一时间看更新
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