Aws-node-rest-api-with-dynamodb with a few db attributes


#1

Hi,
aws-node-rest-api-with-dynamodb example comes with one attribute. has anyone extended it to include more attributes? I added a new field - intent. but it is not working. Thanks for your help.

if (typeof data.text !== 'string') {
    console.error('Validation Failed');
    callback(new Error('Couldn\'t create the flowstat item.'));
    return;
  }
  if (typeof data.intent !== 'string') {
    console.error('Validation Failed');
    callback(new Error('Couldn\'t create the flowstat item.'));
    return;
  }

  const params = {
    TableName: process.env.DYNAMODB_TABLE,
    Item: {
      id: uuid.v1(),
      text: data.text,
      intent: data.intent,
      checked: false,
      createdAt: timestamp,
      updatedAt: timestamp,

#2

Your code snippet doesn’t look complete, can you include the rest?

Also, you’ll need to give us more information than “it’s not work working”. What happens? Do you get any error messages?


#3

Thank you. I eventually got it to work. Not sure though what i was doing wrong. perhaps made a typo
somewhere…