🐺🎾 Checkpoint

./server.js:1954897/62
This commit is contained in:
Glitch (glitch-hello-node)
2021-11-14 05:26:29 +00:00
parent b2ced5bc42
commit 4631ab98e8
2 changed files with 13 additions and 2 deletions
+11
View File
@@ -0,0 +1,11 @@
ECSW,1636867215164,2
ECSW,1636867418674,2
ECSW,1636867436265,2
ECSW,1636867454254,2
ECSW,1636867483276,3
ECSW,1636867504369,4
ECSW,1636867518408,4
ECSW,1636867532340,5
ECSW,1636867547293,5
ECSW,1636867561416,6
ECSW,1636867587158,6
1 ECSW 1636867215164 2
2 ECSW 1636867418674 2
3 ECSW 1636867436265 2
4 ECSW 1636867454254 2
5 ECSW 1636867483276 3
6 ECSW 1636867504369 4
7 ECSW 1636867518408 4
8 ECSW 1636867532340 5
9 ECSW 1636867547293 5
10 ECSW 1636867561416 6
11 ECSW 1636867587158 6
+2 -2
View File
@@ -11,14 +11,14 @@ app.post('/', (req, res) => {
const loc = req.get('User-Agent').slice(3)
const time = req.get('X-Timestamp') || Date.now()
console.log(`Writing to database! ${loc}, ${time}, ${count}`)
res.sendStatus(200)
res.sendStatus(204)
fs.appendFile('db.csv', `${loc},${time},${count}\n`, function (err) {
if (err) throw err;
console.log('Saved!');
})
})
app.get('db.csv', (_, res) => res.sendFile('db.csv'))
app.get('/db.csv', (_, res) => res.sendFile(`${__dirname}/db.csv`))
app.listen(port, () => {
console.log(`Listening at http://localhost:${port}`)