Guest User

Untitled

a guest
Nov 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. async function getData() {
  2. try {
  3. const [ users , charts ] = await Promise.all([
  4. db('users').select('*'),
  5. db('chats').select('*')
  6. ]);
  7. console.log('users', users);
  8. console.log('chats', chats);
  9. }
  10. catch(err) {
  11. console.log(err)
  12. }
  13. }
  14.  
  15. getData()
  16.  
  17.  
  18. ============ OUTPUT ==============
  19.  
  20. users [ anonymous {
  21. id: 1,
  22. user_id: '7d3858a9-dbc3-4c43-b7c7-422136e5a3fc',
  23. created_at: '1511378256429',
  24. username: 'leptone',
  25. password: '1245' },
  26. anonymous {
  27. id: 2,
  28. user_id: 'c9f1f03e-8a01-452a-8e9e-1d83efd8e56a',
  29. created_at: '1511378256429',
  30. username: 'csiebel',
  31. password: '1245' } ]
  32. ReferenceError: chats is not defined
  33. at getData (/Users/casey/Dev/lang-exchange/src/server/db/seeds/user_chat_seed.js:11:30)
  34. at <anonymous>
Add Comment
Please, Sign In to add comment