I'm using fetch to send data to a .json but since i can't refactor my requires to import and can't use fetch with require, i can't use it. And since it's not a web app, i can't use the script tag as i saw in other posts.
My code
*..*
fetch('./src/Data/hf.json', {
method: 'POST',
body: JSON.stringify({
id: Math.random().toString(36).substr(2, 9),
title: args.args,
createdByUser: user.tag,
createdById: user.id,
timestamp: message.createdTimestamp,
}),
headers : {
'Content-type': 'application/json; charset=UTF-8'
}
}).then(res => {
if (res.ok) return res.json();
});
*..*