LITTLEFS
LITTLEFS copied to clipboard
Trouble fetching file from AsyncWebServer.
I have a file called data.json created by LittleFS on my AsyncWebServer. Now I am trying to fetch that file from index.html file in root of same domain using following:
fetch("data.json").then(r => r.json()).then(packed => {wait.textContent = "Rendering...";
let data = prepData(packed);
setTimeout(() => makeChart(data), 0);
});
But it gives me following error message:
(index):640 GET http://192.168.0.9/data.json 500 (Internal Server Error)
(index):640 Fetch failed loading: GET "http://192.168.0.9/data.json".
Am I fetching the file from right directory ? Should I try different directory ?
In a sketch I defined file as "/data.json"
Thanks.
Following is message in my serial console:
Appended to file: ,1623568771,6,2.92,-37,54,72,231,91]
File size: 110
Reading from '/data.json' file....
[8,"Epoch","Location","V","S","T","H","P","L",1623568737,0,0.00,0,0,0,0,0,1623568761,26,2.94,-43,46,64,237,70,1623568771,6,2.92,-37,54,72,231,91]
Accepting a new client!
NOT_FOUND: GET http://192.168.0.9/data.json
_HEADER[Host]: 192.168.0.9
_HEADER[Connection]: keep-alive
_HEADER[User-Agent]: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
_HEADER[Accept]: */*
_HEADER[Referer]: http://192.168.0.9/
_HEADER[Accept-Encoding]: gzip, deflate
_HEADER[Accept-Language]: en-US,en;q=0.9