Lambda function getPublications
Method: GET
Validates the origin URL with safeGetHeaders
Endpoints
- on test stage: https://hjoutysc5k.execute-api.eu-west-1.amazonaws.com/test/get-publications
- on prod stage: https://267sder6c7.execute-api.eu-west-1.amazonaws.com/prod/get-publications
// Call locally from the CLI:
DEBUG=true npx sls invoke local --function getPublications --path test/staticSiteMailer-dummy-payload.json
// Expected payload
{
"headers": {
"origin": "ORIGIN"
},
"body": "[ { id: "123", "title": "My Post" } ]",
}Returns Promise<void> Nothing is returned, AWS callback is used instead
Lambda function staticSiteMailer
Method: POST
Expected fields:
- name {string}
- email {string}
- message {string}
Validates the origin URL with safeGetHeaders
Endpoints
- on test stage: https://hjoutysc5k.execute-api.eu-west-1.amazonaws.com/test/static-site-mailer
- on prod stage: https://267sder6c7.execute-api.eu-west-1.amazonaws.com/prod/static-site-mailer
Envars that need to be set: process.env.STATIC_SITE_MAILER_SOURCE; process.env.STATIC_SITE_MAILER_DESTINATION;
Both mail addresses need to be validated in AWS SES
// Call locally from the CLI:
STATIC_SITE_MAILER_SOURCE=example@example.com STATIC_SITE_MAILER_DESTINATION=example@example.com DEBUG=true npx sls invoke local --function staticSiteMailer --path test/staticSiteMailer-dummy-payload.json
// Expected payload
{
"headers": {
"origin": "ORIGIN"
},
"body": "{\"name\": \"Sender Name\",\"email\": \"sender@example.com\",\"message\": \"This is a dummy message to test the contact form\",\"phone\": \"123\"}",
}Returns Promise<void> Nothing is returned, AWS callback is used instead
Gets reponse headers but throws error if the requesting origin is not whitelisted. This must be done before anything else to prevent calls from unknown origins.
originstring URL describing the origin of the call
Returns Object headers