Mercurial > cgi-bin > hgwebdir.cgi > POP > oldRepo
view 1__Development/6__Website/POPExpressServer/routes/saveJSON.js @ 8:cc10d99e3f83
Persist and read back from disk and parse to objects is working.. Display needs updating now
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Sat, 09 Aug 2014 03:34:26 -0700 |
| parents | |
| children |
line source
1 /* These are the functions that handle the various routes
2 */
4 var fs = require('fs');
5 var errHdlr = function (err) {
6 if( err ) return console.log( "Error writing file: " + err );
7 }
9 exports.saveJSON = function(req, res) {
10 res.send( req.query.json );
11 fs.writeFile('./savedSyntaxGraphs/syntaxGraph.txt', req.query.json, errHdlr);
12 };
14 //fs = require('fs');
15 //fs.writeFile(filename, data, [encoding], [callback])
