breakout71/editserver.js

22 lines
470 B
JavaScript
Raw Normal View History

const express = require('express')
const bodyParser = require('body-parser');
const fs = require('fs')
const app = express()
const port = 4400
app.use(bodyParser.text({
type: 'text/plain',
limit:'1MB'
}));
2025-03-13 10:02:49 +01:00
app.post('/src/levels.json', (req, res) => {
if(req.body?.trim()) {
2025-03-13 10:02:49 +01:00
fs.writeFileSync('src/levels.json', req.body)
}
res.end('OK')
})
app.listen(port, () => {
console.log(`Example app listening on port http://localhost:${port}`)
})