Guest User

Untitled

a guest
Jan 28th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. [nodemon] to restart at any time, enter `rs`
  2. [nodemon] watching: *.*
  3. [nodemon] starting `node server.js`
  4. Running on port 3000
  5. Connection established
  6. [nodemon] restarting due to changes...
  7. [nodemon] restarting due to changes...
  8. [nodemon] starting `node server.js`
  9. Running on port 3000
  10. Connection established
  11. 5c4b294efb654f1770522264
  12. { _id: 5c4b294efb654f1770522264,
  13. email: 'dev@dev.com',
  14. username: 'devbeans',
  15. password:
  16. '$2a$10$Gl8uMUy.enGaWnUYmcDRmexj/ITJ0Ys48I4535fjb4GNmRjBeg9wO',
  17. ethAddress: '0x967bb849e15b26133e98d7a80f7c71636b4c68e8',
  18. privateKey:
  19. '774ed5b09062af0fcd7760cd2dd0052ed32f0f8ffd5d5b9062782c568a49c6e0',
  20. __v: 0 }
  21. undefined
  22. POST /api/getTransactions 200 264.266 ms - -
  23.  
  24. userId = req.body._id
  25. console.log(userId)
  26. //console.log(process.env.NODE_ENV)
  27. User.findOne({ _id: userId }, function (err, user) {
  28. console.log(user)
  29.  
  30. if (user) {
  31. console.log(user.transactions)
  32. res.send(user.transactions)
  33. } else {
  34. console.log(err)
  35. }
  36.  
  37. })
  38. })
  39.  
  40. var TransactionSchema = new Schema({
  41. time: {
  42. type: String
  43. },
  44. date : {
  45. type: String
  46. },
  47. transactionType : {
  48. type: String
  49. },
  50. email : {
  51. type: String
  52. },
  53. amount: {
  54. type: String
  55. },
  56. txHash:{
  57. type: String
  58. }
  59. })
  60.  
  61. var UserSchema = new Schema({
  62. username: {
  63. type: String
  64. },
  65. email: {
  66. type: String,
  67. },
  68. password: {
  69. type: String
  70. },
  71. ethAddress: {
  72. type: String
  73. },
  74. privateKey: {
  75. type: String
  76. },
  77. transactions: TransactionSchema,
  78. })
Add Comment
Please, Sign In to add comment