Lets say i have two variables in my NodeJS front end Example.js file:
var a;
var b;
function senddata() {
a = "Hassan";
b = 7;
}
return true;
Now what i'd like to do is send these two variables to my server using a POST request. At the backend i'm using ExpressJS for my routes.
In my Routes.js(At the backend) i want to receive the values of a and b through a POST request from my senddata() function.
In my routes i have created this route for the data:
router.post('/save', function (req, res, next) {
//Sending values of a and b to my database
});