I am new to node/express js and have a simple app which provides an index.html
in that html this gives me a 404 not found error
$.ajax({
type: 'POST',
url: url + "/json/addData'",
contentType: 'application/json',
data: {"app" : JSON.stringify("ID=10")},
cache: false,
success: function (result) { console.log(result); }
});
but this works fine
http://localhost:8081/api/json/addData?id=10
to this function running in the express app instance
app.get('/api/json/addData/', function (req, res) {
console.log(req.query.id);
res.send("Success");
});
when changing the function to app.post I still get a 404. when changing the ajax to get I again get a 404 error
what would be the correct way to post a javascript object (or it's values) to a node app and how to recieve it ?
sorry for the noob questions. All searching brought so far no working result for me