I am doing a post request to my nodeJS server like this.
So whenever i click on the button it gives a post with a JSON: if i console.log the JSON it gives me the good parameters so that’s not the problem.
let data = {
username: this.username,
email: this.email,
password1: this.password1,
password2: this.password2
};
this.http.post("http://localhost:3000/", data, {}).subscribe(data => {
this.dataUser = data;
}, error => {
console.log(error);
});
and from my server.js i do this to get the post but i get a
POST http://localhost:3000/ 404 (Not Found)
so i have no clue how to fix this. On my server side so the server.js file i do this:
app.get("/", (req, res) => {
console.log({" / ": true});
request('http://localhost:8100/create-account', function (error, response, body) {
res.json(response);
if(error) {
throw error;
}
});
});