So I want to send a file to the node server which requires something from the front end. I looked around to see how I could use my app.post("",req) to retrieve confirmation of a website. However I came across a problem.
Here is the sample code:
fetch(slink, {method: "POST", headers:{
"Content-type":"application/json"
}, body: {request: "Site Request"}}).then((resp)=>{
return resp.json();
Thats the front end, now the back end (server side)...
app.use(bodyParser.json())
app.post("/resources",(req, resp)=>{
console.log(req.body)
resp.json(jsnfile) // this part works however
})
When these two are run together, the javascript on the front end isn't received on the back end, which returns an empty dictionary {}. What did I do wrong?