how to call multiples events in aws lambda function

Solutions on MaxInterview for how to call multiples events in aws lambda function by the best coders in the world

showing results for - "how to call multiples events in aws lambda function"
Azariah
03 Oct 2020
1exports.handler = async (event, context, callback) => {
2    const type = event.type;
3    if (type === 'all') {
4        const params = {
5            TableName: 'compare-yourself'
6        }
7        try {
8            const data = await dynamodb.scan(params).promise()
9            callback(null, data)
10        } catch(error) {
11            callback(error);
12        }
13    } else if (type === 'single') {
14        callback(null, 'Just my data');
15    } else {
16        callback(null, 'Hello from Lambda');
17    }
18};