Nodejs hängen an JSON an
//Because we want JSON format to the file, we first need to read the file
//parse the data to JS object
//push the new items
//and then overwrite the file
var fs = require('fs')
var currentSearchResult = 'example'
fs.readFile('results.json', function (err, data) {
var json = JSON.parse(data)
json.push('search result: ' + currentSearchResult)
fs.writeFile("results.json", JSON.stringify(json))
})
Sugared Bun