Receives an object representing the state of an http message { request, response, context }
Returns the state after processing (see src/index.handler)
# http.IncomingMessage
request:
headers:
content-type: application/ld+json
accept: application/ld+json,application/x-turtle
method: POST
url: 'https://user.example.com/inbox/'
# http body string (unparsed)
body: ''
# http.ServerResponse
response:
headers:
link: </context.json>; rel="http://www.w3.org/ns/json-ld#context"
x-powered-by: yodata/solid-server
# stuff we need goes here
context:
agent: 'https://max.example.com/profile/card#me'
instrument: 'https://vendor-application.example.com/profile/card#me'.
├── README.md <-- this file
├── src <-- Source code for a lambda function
│ ├── index.js <-- Lambda function code
│ ├── package.json <-- NodeJS dependencies
│ └── tests <-- Unit tests
│ └── unit
│ └── test_handler.js
└── template.yaml <-- AWS SAM Deployment Template- AWS CLI already configured with Administrator permission
- NodeJS 8.10+ installed
- Docker installed
cd src
npm install
cd ../ > sam local invoke --event example-event.jsonFirstly, we need a S3 bucket where we can upload our Lambda functions packaged as ZIP before we deploy anything - If you don't have a S3 bucket to store code artifacts then this is a good time to create one:
aws s3 mb s3://yodata-solid-serverless-package-api-middleware
aws s3 mb s3://BUCKET_NAMENext, run the following command to package our Lambda function to S3:
. packageNext, the following command will create a Cloudformation Stack and deploy your SAM resources.
. deploy> cd src
> npm run test