This commit is contained in:
Renan LE CARO 2025-04-06 11:27:26 +02:00
parent 23c98589d1
commit 74cb0c9eab
4 changed files with 132 additions and 131 deletions

View file

@ -9,8 +9,14 @@ app.use(bodyParser.text({
limit:'1MB'
}));
app.get('/src/data/levels.json', (req, res) => {
console.log('src/data/levels.json')
res.json(JSON.parse(fs.readFileSync('src/data/levels.json')))
})
app.post('/src/data/levels.json', (req, res) => {
if(req.body?.trim()) {
console.log('Levels updated')
fs.writeFileSync('src/data/levels.json', req.body)
}
res.end('OK')