Add messages to .gitignore.

Tweak default port.
Add newline after each log.
This commit is contained in:
Sage Vaillancourt 2024-06-22 08:17:54 -04:00
parent 7971ab5d7a
commit d0653ff184
4 changed files with 3 additions and 3 deletions

1
.gitignore vendored
View File

@ -32,3 +32,4 @@ npm-debug.log
.DS_Store
.env
messages

View File

@ -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);
/**

View File

@ -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"}

View File

@ -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)
})