Guest User

Untitled

a guest
Jan 28th, 2019
166
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. username: 'devbeans',
  14. password:
  15. '$2a$10$Gl8uMUy.enGaWnUYmcDRmexj/ITJ0Ys48I4535fjb4GNmRjBeg9wO',
  16. ethAddress: '0x967bb849e15b26133e98d7a80f7c71636b4c68e8',
  17. privateKey:
  18. '774ed5b09062af0fcd7760cd2dd0052ed32f0f8ffd5d5b9062782c568a49c6e0',
  19. __v: 0 }
  20. undefined
  21. POST /api/getTransactions 200 264.266 ms - -
  22.  
  23. userId = req.body._id
  24. console.log(userId)
  25. //console.log(process.env.NODE_ENV)
  26. User.findOne({ _id: userId }, function (err, user) {
  27. console.log(user)
  28.  
  29. if (user) {
  30. console.log(user.transactions)
  31. res.send(user.transactions)
  32. } else {
  33. console.log(err)
  34. }
  35.  
  36. })
  37. })
  38.  
  39. var TransactionSchema = new Schema({
  40. time: {
  41. type: String
  42. },
  43. date : {
  44. type: String
  45. },
  46. transactionType : {
  47. type: String
  48. },
  49. email : {
  50. type: String
  51. },
  52. amount: {
  53. type: String
  54. },
  55. txHash:{
  56. type: String
  57. }
  58. })
  59.  
  60. var UserSchema = new Schema({
  61. username: {
  62. type: String
  63. },
  64. email: {
  65. type: String,
  66. },
  67. password: {
  68. type: String
  69. },
  70. ethAddress: {
  71. type: String
  72. },
  73. privateKey: {
  74. type: String
  75. },
  76. transactions: TransactionSchema,
  77. })
Add Comment
Please, Sign In to add comment