From 44d1990a9947bc4fe9b8bb3902d9aec0441c9f77 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Wed, 3 Jul 2019 13:55:24 +0300 Subject: Implement web UI --- server.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 server.js (limited to 'server.js') 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}!`)) -- cgit v1.3