Add messages to .gitignore.
Tweak default port. Add newline after each log.
This commit is contained in:
parent
7971ab5d7a
commit
d0653ff184
|
@ -32,3 +32,4 @@ npm-debug.log
|
|||
.DS_Store
|
||||
|
||||
.env
|
||||
messages
|
||||
|
|
2
bin/www
2
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);
|
||||
|
||||
/**
|
||||
|
|
1
messages
1
messages
|
@ -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"}
|
|
@ -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)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue