Skip to content

Instantly share code, notes, and snippets.

@onema
Last active October 31, 2018 04:35
Show Gist options
  • Save onema/fbcfd0bfead18542d0ec5630a71a2402 to your computer and use it in GitHub Desktop.
Save onema/fbcfd0bfead18542d0ec5630a71a2402 to your computer and use it in GitHub Desktop.
import com.amazonaws.serverless.proxy.model.{AwsProxyRequest, AwsProxyResponse}
import com.amazonaws.services.lambda.runtime.Context
import io.onema.userverless.configuration.lambda.NoopLambdaConfiguration
import io.onema.userverless.function.ApiGatewayHandler
import io.onema.userverless.function.ApiGatewayHandler.Cors
import org.apache.http.HttpStatus
class ApiGatewayFunction
extends ApiGatewayHandler
with Cors
with NoopLambdaConfiguration {
//--- Methods ---
override protected def corsConfiguration(origin: Option[String]) = new EnvCorsConfiguration(origin)
def execute(request: AwsProxyRequest, context: Context): AwsProxyResponse = {
cors(request) {
new AwsProxyResponse(HttpStatus.SC_OK)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment