From d0653ff184981cac96c11782565cb692e77830b1 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sat, 22 Jun 2024 08:17:54 -0400 Subject: [PATCH] Add messages to .gitignore. Tweak default port. Add newline after each log. --- .gitignore | 1 + bin/www | 2 +- messages | 1 - routes/index.js | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 messages diff --git a/.gitignore b/.gitignore index 27ff0bd..429d8ba 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ npm-debug.log .DS_Store .env +messages diff --git a/bin/www b/bin/www index 7ae21bd..1f47108 100755 --- a/bin/www +++ b/bin/www @@ -12,7 +12,7 @@ var http = require('http'); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '3000'); +var port = normalizePort('3010'); app.set('port', port); /** diff --git a/messages b/messages deleted file mode 100644 index 4379aa3..0000000 --- a/messages +++ /dev/null @@ -1 +0,0 @@ -{"message":"Please no bad things and stuff","timestamp":"2024-06-22T11:55:26.771Z"}{"message":"Howdy","timestamp":"2024-06-22T12:07:53.738Z"} \ No newline at end of file diff --git a/routes/index.js b/routes/index.js index 5e989cb..b5c0443 100644 --- a/routes/index.js +++ b/routes/index.js @@ -15,7 +15,7 @@ router.get('/', function(req, res, next) { router.post('/', (req, res) => { const log = { message: req.body.message, timestamp: new Date() } - fs.appendFileSync(file, JSON.stringify(log)) + fs.appendFileSync(file, JSON.stringify(log) + '\n') get(res, true) })