Skip to content

Instantly share code, notes, and snippets.

@juancho088
Created June 10, 2018 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juancho088/891ef5a1b274e32ca9c06af3d2b60368 to your computer and use it in GitHub Desktop.
Save juancho088/891ef5a1b274e32ca9c06af3d2b60368 to your computer and use it in GitHub Desktop.
Default Handler that Serverless Framework creates
import com.amazonaws.services.lambda.runtime.Context
import com.amazonaws.services.lambda.runtime.RequestHandler
import org.apache.logging.log4j.LogManager
class Handler:RequestHandler<Map<String, Any>, ApiGatewayResponse> {
override fun handleRequest(input:Map<String, Any>, context:Context):ApiGatewayResponse {
LOG.info("received: " + input.keys.toString())
return ApiGatewayResponse.build {
statusCode = 200
objectBody = HelloResponse("Go Serverless v1.x! Your Kotlin function executed successfully!", input)
headers = mapOf("X-Powered-By" to "AWS Lambda & serverless")
}
}
companion object {
private val LOG = LogManager.getLogger(Handler::class.java)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment