Guest User

Untitled

a guest
Jan 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. // Node.js
  2. router.get('/users/all', authenticate, (req, res) => {
  3. User.find({some query}).select('firstName lastName email').then((users) => {
  4. res.send(users);
  5. });
  6.  
  7.  
  8. //Angular Service
  9. return this.http.get(getUserDataUrl, opts)
  10. .pipe(
  11. map(response => {
  12. // here is the problem
  13. console.log(response.json());
  14. return response.json()
  15. }),
  16. catchError(this.handleErrors)
  17. );
  18.  
  19. // Node.js
  20. router.get('/users/all', authenticate, (req, res) => {
  21. User.findOne({some query}).select('firstName lastName email').then((user) => {
  22. res.send(user); // there was a typo I changed it too. look in the question not user it was users.
  23. });
Add Comment
Please, Sign In to add comment