Module

Amazon.Alexa.Handler

Package
purescript-alexa
Repository
twitchard/purescript-alexa

#makeHandler Source

makeHandler :: forall eff. (Foreign -> Foreign -> (Aff eff Foreign)) -> Handler eff

Converts a curried function to produce an uncurried function of the form expected by AWS lambda.

myHandler :: ∀ e. Foreign → Foreign → Aff e Foreign
myHandler event context =
  pure <<< encode $ "Return this string"

handler = makeHandler myHandler

will produce the equivalent of

exports.handler = function (event, context, callback) {
  return callback(null, "Return this string")
}