Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been trying to send an object over to another file. I have the solution for writing to an excel file by pushing a button on the frontend, and the file gets written on the backend.

However, I am tring to do something similar, only I want to be able to send an object that would be contained on the button page, over the file (post.controllers). But anything I try doesn't work. Can I have some suggestions please? Here is the link to the files on Github. There are no node modules, because I was having errors uploading/pushing 

 https://github.com/ThomasM10/01WorkingExcelEdit-Test02

What I have tried:

I have tried many things, one such as 

// in the buttonPage.  

<pre>const objectTransfer = (event) => {
    event.preventDefault();
    fetch("http://localhost:3000/storedReceivingObject", {
        method: 'POST',
        body: JSON.stringify(storedReceivingObject),
        headers: {
        'Accept': 'application/json',
        },
    }
)}




// and on the post.controllers page

app.use('/storedReceivingObject', postRoutes);
Posted
Updated 18-Nov-22 6:57am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900