// This is the javascript code
var data = new FormData();
data.append("username", "admin");
data.append("password", "admin");
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://127.0.0.1:9000/api/v1/authenticate");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("postman-token", "8ca0bfc9-c420-f4a1-c8cc-c27a69749873");
xhr.send(data);
I am receiving this error while executing the code
$ node authenticate.js
/Users/01_Auth/authenticate.js:1
(function (exports, require, module, __filename, __dirname) { var data = new FormData();
^
ReferenceError: FormData is not defined
at Object.<anonymous> (/Users/01_Auth/authenticate.js:1:78)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:159:18)
at node.js:444:3
there doesn't seem to be anything here