2025-02-15 19:21:00 +01:00
|
|
|
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-16 17:45:29 +01:00
|
|
|
app.post('/src/data/levels.json', (req, res) => {
|
2025-02-15 19:21:00 +01:00
|
|
|
if(req.body?.trim()) {
|
2025-03-16 17:45:29 +01:00
|
|
|
fs.writeFileSync('src/data/levels.json', req.body)
|
2025-02-15 19:21:00 +01:00
|
|
|
}
|
|
|
|
res.end('OK')
|
|
|
|
})
|
|
|
|
|
|
|
|
app.listen(port, () => {
|
2025-03-15 10:34:01 +01:00
|
|
|
console.info(`Editor BE listening on port http://localhost:${port}`)
|
2025-02-15 19:21:00 +01:00
|
|
|
})
|