I have created a post request that receives a users ethereum address from the users end. Next I need to add the string to the users existing record in a mongoDB database.
app.post('/post', async (req,res) => {
res.set({ 'Content-Length': 64 })
res.json(req.body)
const address = JSON.stringify(req.body.address)
let temp = address.length-2;
var walletAddress = address.slice(2, temp) //This is to remove brackets and speech marks from the string
walletAddress = utils.getAddress(walletAddress)
console.log(walletAddress);
res.end("yes");
//saving data in an existing mongodb
});
I've tried so many different ways and they have all presented an error off some kind.
Sorry if this is really obvious I am a noob, but help is greatly appreciated
I recommend using the official mongoDB driver. npm install mongodb
On their GitHub repository