Pardon me if this is a completely idiotic question but I just can't figure it out.
I'm writing an app in Node.js with the Express framework. I have a URI mapping designed to analyze some Twitter data for sentiment on a given subject in some aggregation units and return the GeoJSON object containing these results to the client.
Here are some details on the data.
require call. These points will later be used to make markers in a Leaflet map.mongodb driver.And this is the process for altering these GeoJSON Points
requiremarker.properties.class to the classificationSo here's my problem, the GeoJSON I load with require is never changed.
Is data loaded via a call to require mutable? If not, is there a simple way to make it mutable, and by that I mean simpler than copying the object?
Does anyone know why console.log() doesn't work when a Node server is running with the Express framework? I swear it did before.
Modules can be deleted from cache. You just need to do:
delete require.cache[moduleName];
Anyway this is not the best approach.
It is much better to export a constructor function and instantiate a new object when needed. For example:
//in geo.js
function Geo() {...}
module.exports = Geo;
//in another module
var Geo = require('./geo.js');
var geo = new Geo();