diff 1__Development/6__Website/POPExpressServer/routes/saveJSON.js @ 5:e73fbbcb5fd2

Persisting basic graph works, starting to add persist of view hierarchy too
author Sean Halle <seanhalle@yahoo.com>
date Sun, 03 Aug 2014 23:38:15 -0700
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/1__Development/6__Website/POPExpressServer/routes/saveJSON.js	Sun Aug 03 23:38:15 2014 -0700
     1.3 @@ -0,0 +1,16 @@
     1.4 +/* These are the functions that handle the various routes 
     1.5 + */
     1.6 +
     1.7 +var fs = require('fs');
     1.8 +var errHdlr = function (err) {
     1.9 +  if( err ) return console.log( "Error writing file: " + err );
    1.10 +}
    1.11 +
    1.12 +exports.saveJSON = function(req, res) {
    1.13 +  res.send( req.query.json );
    1.14 +  fs.writeFile('./savedSyntaxGraphs/syntaxGraph.txt', req.query.json, errHdlr);
    1.15 +};
    1.16 +
    1.17 +//fs = require('fs');
    1.18 +//fs.writeFile(filename, data, [encoding], [callback])
    1.19 +