Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var http = require("http");
- var result;
- http.request({
- url: "https://myBackend.org/api/post",
- method: "POST",
- headers: { "Content-Type": "application/json" },
- content: JSON.stringify({ username: "ValueOne", password: "ValueTwo" })
- }).then(function (response) {
- result = response.content.toJSON();
- console.log(result); //result.message would have the clients auth token
- }, function (e) {
- // console.log("Error occurred " + e);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement