Guest User

Untitled

a guest
Dec 19th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import { Router } from 'meteor/iron:router';
  2.  
  3. Router.route('/testroute').post(function(){
  4. var response;
  5. if(this.request.body.userName === undefined || this.request.body.userPassword === undefined) {
  6. response = {
  7. "error" : true,
  8. "message" : "invalid data"
  9. };
  10. } else {
  11. console.log(" Request Body is : ",this.request.body);
  12. response = {
  13. "error" : false,
  14. "message" : "User added."
  15. }
  16. }
  17. this.response.setHeader('Content-Type','application/json');
  18. this.response.end(JSON.stringify(response));
  19. });
  20.  
  21. Exception in callback of async function: TypeError: Cannot read property 'route' of undefined
Add Comment
Please, Sign In to add comment