I want to read a json file from my folder and putting the result into my nodejs controller.
var request = require('request');
request('../global/language/gb.json', function (err, res, body) {
if (err) {
console.log(err);
}
if (!err && res.statusCode == 200) {
var importedJSON = JSON.parse(body);
console.log(importedJSON);
}
})
I keep getting
Error: Invalid URI "../global/language/gb.json"
at Request.init (G:\Dropbox\ThaiHome\Github\server\node_modules\request\request.js
Is that because it only likes a real http URL?
Or is there another way to read a json file from the harddisk?