diff options
Diffstat (limited to 'server.js')
| -rw-r--r-- | server.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/server.js b/server.js new file mode 100644 index 0000000..cdd7ebb --- /dev/null +++ b/server.js @@ -0,0 +1,19 @@ +const express = require('express') +const app = express(); +const port = 3000; + +const { convert } = require('./converter'); + +app.use(express.static('public')); +app.use(express.json()); + +app.post('/convert', (req, res) => { + const data = req.body; + const jsonInput = data.json; + const xmlOutput = convert(jsonInput); + res.json({ + xml: xmlOutput, + }); +}) + +app.listen(port, () => console.log(`Example app listening on http://localhost:${port}!`)) |
