A Serverless API for the Event Manager App, built using the serverless-bundle. Consumed by the event-manager-app UI.
/create
- given an event as JSON, creates an event with the ID of the currently authenticated user/getAllEvents
- gets all events from a DynamoDB belonging to the currently authenticated user
The lambdas are bundled by Webpack and the builds are uploaded to an S3 bucket.
To deploy, run serverless deploy --stage=ENV
, where ENV is replaced by the target environment
Assuming the correct AWS credentials have been supplied, running the following commands invokes the lambdas locally:
- createEvents:
serverless invoke local --function createEvent --path mockRequests/create-event.json
- getAllEvents:
serverless invoke local --function getAllEvents --path mockRequests/get-all-events.json
Note: a cognito user id needs to be supplied as part of the request:
"requestContext": {
"identity": {
"cognitoIdentityId": "TEST-USER-1234"
}
}
- Run
npm test
to run the unit tests under/tests/unittests
Currently, they are set up to use a test instance of a real DynamoDB. Ideally should test against a local DB instance instead.
- Run
npm run test-int
to run the integration tests under/tests/integration