I am trying to access the expression passed from the backend to the frontend through axios.
Producer side:
const axios = require('axios');
const URL = "http://localhost:5000/"
let n1 = 3
let n2 = 5
let sum = n1+n2;
axios.post(URL, JSON.stringify({
expression: sum,
}))
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
and on the consumer side:
const express = require('express')
const app = express()
app.post('/', (req, res) => {
console.log(req.body);
})
app.listen(5000, () => console.log())
Ultimately, I would like to have the consumer side log "8"