score:1

Accepted answer

your problem is that the data.json file is not in the public folder. you have to move it there from your root folder. only files in the public folder can be accessed by domain.tld/file. also you have to specify the full file name:

let res = await fetch(`${server}/data.json`);

Related Query

More Query from same tag