aboutsummaryrefslogtreecommitdiffstats
path: root/csci4131/hw5/strap012_hw5/createServer.js
diff options
context:
space:
mode:
Diffstat (limited to 'csci4131/hw5/strap012_hw5/createServer.js')
-rwxr-xr-xcsci4131/hw5/strap012_hw5/createServer.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/csci4131/hw5/strap012_hw5/createServer.js b/csci4131/hw5/strap012_hw5/createServer.js
index bd25de5..9c108cd 100755
--- a/csci4131/hw5/strap012_hw5/createServer.js
+++ b/csci4131/hw5/strap012_hw5/createServer.js
@@ -78,14 +78,13 @@ function POST(req, res) {
jsonO["email"] = postObj.email;
jsonO["website_name"] = postObj.website_name;
jsonO["website_url"] = postObj.website_url;
- let read = fs.readFile('./contacts.json', 'utf8', function(err, data) {
+ fs.readFile('./contacts.json', 'utf8', function(err, data) {
var file = JSON.parse(data);
file.contacts.push(jsonO);
var string = JSON.stringify(file);
fs.writeFile('./contacts.json', string, function(err, data) {
console.log(string);
- });
- });
-
- });
+ }); //Write clojure
+ }); //Read clojure
+ }); //req clojure
} \ No newline at end of file