-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.js
38 lines (32 loc) · 806 Bytes
/
handler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
const somar = require('./aritimetica/somar');
const multi = require('./aritimetica/multiplicar')
module.exports.hello = async (event,context) => {
try {
let result = 0;
let operation = '';
if (event.operation === 'somar') {
result = somar.somar(event.number1, event.number2);
operation = 'somar';
} else if (event.operation === 'multiplicar') {
result = multi.multiplicar(event.number1, event.number2)
operation = 'multiplicar';
} else {
operation = 'Não encontrada';
}
const data = {
result: result,
operation: operation
}
return {
statusCode: 200,
data: data,
context: context
};
} catch (error) {
return {
statusCode: 500,
error: error.message,
}
}
};