Guest User

Untitled

a guest
Jul 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. /users/getByState/stateId
  2.  
  3. /user/getByState/tx
  4.  
  5. /user/getByState/ny
  6.  
  7. FILTER:{stateID:'tx'}
  8.  
  9. FILTER:{stateId:'tx'}
  10. FILTER:{stateId:'ny'}
  11.  
  12. const Datastore = require('@google-cloud/datastore');
  13. const datastore=Datastore();
  14. const query=datastore.createQuery("user");
  15.  
  16. exports.get_user_by_state =(req,res,next) => {
  17. const pageCursor = req.query.cursor;
  18. const userState=req.params.stateId;
  19.  
  20. const selectQuery = query
  21. .filter('stateId',userState)
  22.  
  23. console.log(selectQuery);
  24.  
  25. selectQuery.run({cache:false})
  26. .then((results) => {
  27. res.json(results);
  28. })
  29. .catch(err => res.status(500).json(err));
  30. }
Add Comment
Please, Sign In to add comment