Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. var async = require('async');
  2.  
  3. exports.handler = async (event, context, callback) => {
  4. async.waterfall([
  5. function(callback) {
  6. console.log("ONE");
  7. callback(null, 1);
  8. },
  9. function(resp, callback) {
  10. console.log("TWO : ", resp);
  11. callback(null, 2);
  12. },
  13. function(resp, callback){
  14. console.log("THREE : ", resp);
  15. callback(null, "Done");
  16. }
  17. ],
  18. function(err, resp) {
  19. let response = {};
  20. if (err) {
  21. console.log("Error",err);
  22. response = {
  23. statusCode: 500,
  24. body: JSON.stringify('Error!'),
  25. };
  26. return response;
  27. } else {
  28. console.log("Success",resp);
  29. response = {
  30. statusCode: 200,
  31. body: JSON.stringify('Ok!'),
  32. };
  33. return response;
  34. }
  35. });
  36. };
  37.  
  38. START RequestId: ab9aa426-dfc9-44ac-8d96-a4f102e30861 Version: $LATEST
  39. 2019-03-21T15:15:26.597Z ab9aa426-dfc9-44ac-8d96-a4f102e30861 ONE
  40. 2019-03-21T15:15:26.597Z ab9aa426-dfc9-44ac-8d96-a4f102e30861 TWO : 1
  41. 2019-03-21T15:15:26.597Z ab9aa426-dfc9-44ac-8d96-a4f102e30861 THREE : 2
  42. 2019-03-21T15:15:26.597Z ab9aa426-dfc9-44ac-8d96-a4f102e30861 Success Done
  43. END RequestId: ab9aa426-dfc9-44ac-8d96-a4f102e30861
  44. REPORT RequestId: ab9aa426-dfc9-44ac-8d96-a4f102e30861 Duration: 37.28 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 67 MB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement