Advertisement
Guest User

Untitled

a guest
Jul 18th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. var http = require("http");
  2. var result;
  3.  
  4. http.request({
  5. url: "https://myBackend.org/api/post",
  6. method: "POST",
  7. headers: { "Content-Type": "application/json" },
  8. content: JSON.stringify({ username: "ValueOne", password: "ValueTwo" })
  9. }).then(function (response) {
  10. result = response.content.toJSON();
  11. console.log(result); //result.message would have the clients auth token
  12. }, function (e) {
  13. // console.log("Error occurred " + e);
  14. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement