annotate 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
rev   line source
seanhalle@5 1 /* These are the functions that handle the various routes
seanhalle@5 2 */
seanhalle@5 3
seanhalle@5 4 var fs = require('fs');
seanhalle@5 5 var errHdlr = function (err) {
seanhalle@5 6 if( err ) return console.log( "Error writing file: " + err );
seanhalle@5 7 }
seanhalle@5 8
seanhalle@5 9 exports.saveJSON = function(req, res) {
seanhalle@5 10 res.send( req.query.json );
seanhalle@5 11 fs.writeFile('./savedSyntaxGraphs/syntaxGraph.txt', req.query.json, errHdlr);
seanhalle@5 12 };
seanhalle@5 13
seanhalle@5 14 //fs = require('fs');
seanhalle@5 15 //fs.writeFile(filename, data, [encoding], [callback])
seanhalle@5 16