INNER CODE UNIT · JavaScript

randomQuote

aws-amplify/amplify-cli · amplify-migration-apps/backend-only/_snapshot.pre.generate/amplify/backend/function/quotegeneratorbe/src/index.js:35

  const randomQuote = quotes[Math.floor(Math.random() * quotes.length)];

  // Add timestamp for uniqueness
  const timestamp = new Date().toISOString();

  // just here to ensure dependencies are migrated over corretly.
  const table = new Table({ head: ['text', 'author'] });
  for (const quote of quotes) {
    table.push([quote.text, quote.author]);
  }

  console.log('Available quotes');
  console.log('');
  console.log(table.toString());

  // For AppSync @function directive, return the data object directly
  return {
    message: 'Quote generated successfully! 🎯',

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…