Having this function in express that writes a jsonJSON file on a folder
var savingtheJson=function(path, jsonObject, callback){ jsonfile.writeFile(file2, jsonO, callback); } I will like to know how can I access/read this file from the browser once is saved.
ifIf I do this:
savingtheJson('/json/myfile.json', jsonObj, function(){ console.log("done it!"); }); When I go to the browser and I type: localhost:8080/json/myfile.json Of
http://localhost:8080/json/myfile.json Of course I get an error from express "Cannot Get ...." cause I think is trying to resolve it like an specific request
How can I store this file into the static folder declared for this goal (app.use(express.static(__dirname + '/public')app.use(express.static(__dirname + '/public'))?
How can I access this file once is saved?