Ivan Rigoni, DAZN Strategies Architect, explains the structure employed by DAZN to highlight essential moments in sporting actions and assist their search for throughout stay streaming capabilities, because of serverless and AI/ML AWS skilled providers.
source
Please need your help. I have this code bellow
var AWS = require('aws-sdk')
AWS.config.update({region:'us-east-2'})
var database = new AWS.DynamoDB.DocumentClient();
exports.handler = async (event) => {
// TODO implement
var method = event.httpMethod;
var myData = JSON.parse(event.body);
console.log('welcome');
console.log(myData);
//check if the httMethod is Get/Post type
if(method == 'GET'){
//performs fetching of the teams in the table
}
else if(method == 'POST'){
//create a new team in the team table
console.log('try to create a new team')
var table = 'team';
var params = {
TableName: table,
Item: {
'team': myData.team,
'short_name': myData.shortName,
'logo': myData.logo,
'tournament': myData.tournament
}
};
database.put(params, function(err, data){
if(err){
console.log('error writing to team table', err);
}
else{
console.log('successfully added team to the table');
}
});
}
const response = {
statusCode: 200,
body: JSON.stringify(myData),
};
return response;
};
The issue is that it doesn't execute the database.put action or if it does execute that code it does not write to the database and yet it does not report any error to the console cloudwatch.
Please need your help. I have this code bellow
var AWS = require('aws-sdk')
AWS.config.update({region:'us-east-2'})
var database = new AWS.DynamoDB.DocumentClient();
exports.handler = async (event) => {
// TODO implement
var method = event.httpMethod;
var myData = JSON.parse(event.body);
console.log('welcome');
console.log(myData);
//check if the httMethod is Get/Post type
if(method == 'GET'){
//performs fetching of the teams in the table
}
else if(method == 'POST'){
//create a new team in the team table
console.log('try to create a new team')
var table = 'team';
var params = {
TableName: table,
Item: {
'team': myData.team,
'short_name': myData.shortName,
'logo': myData.logo,
'tournament': myData.tournament
}
};
database.put(params, function(err, data){
if(err){
console.log('error writing to team table', err);
}
else{
console.log('successfully added team to the table');
}
});
}
const response = {
statusCode: 200,
body: JSON.stringify(myData),
};
return response;
};
The issue is that it doesn't execute the database.put action or if it does execute that code it does not write to the database and yet it does not report any error to the console cloudwatch.