Skip to content

A simple session object for AWS Lambda - with an API Gateway front-end.

License

Notifications You must be signed in to change notification settings

covati/simplesession

Repository files navigation

Simple Session

An API that allows for the storage of session data based off of keys.

This file is incomplete, more soon - hopefully in the form of CloudFormation.

The basic setup for this lambda code is: API Gateway -> header/params management -> Lambda -> Elasitcache (Redis backed)

The translation of the GET has a Mapping Template for application/json:

#set($allParams = $input.params())
{
  "params" : {
    #foreach($type in $allParams.keySet())
    #set($params = $allParams.get($type))
    "$type" : {
      #foreach($paramName in $params.keySet())
      "$paramName" : "$util.escapeJavaScript($params.get($paramName))"
      #if($foreach.hasNext),#end
      #end
    }
    #if($foreach.hasNext),#end
    #end
  },
    "method": "$context.httpMethod"
}

The translation of the POST has a Mapping Template for application/json:

{
    "method": "$context.httpMethod",
    "body" : $input.json('$'),
    "headers": {
        #foreach($param in $input.params().header.keySet())
        "$param": "$util.escapeJavaScript($input.params().header.get($param))"
        #if($foreach.hasNext),#end
        #end
    }
}

About

A simple session object for AWS Lambda - with an API Gateway front-end.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published