mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-20 04:05:06 -04:00
22 lines
479 B
JavaScript
22 lines
479 B
JavaScript
const express = require('express')
|
|
const bodyParser = require('body-parser');
|
|
const fs = require('fs')
|
|
const app = express()
|
|
const port = 4400
|
|
|
|
const srcPath = 'src/levels.json'
|
|
app.use(bodyParser.text({
|
|
type: 'text/plain',
|
|
limit:'1MB'
|
|
}));
|
|
|
|
app.post('/', (req, res) => {
|
|
if(req.body?.trim()) {
|
|
fs.writeFileSync(srcPath, req.body)
|
|
}
|
|
res.end('OK')
|
|
})
|
|
|
|
app.listen(port, () => {
|
|
console.log(`Example app listening on port http://localhost:${port}`)
|
|
})
|