aboutsummaryrefslogtreecommitdiffstats
path: root/server.js
diff options
context:
space:
mode:
authorJan Tuomi <jan.tuomi@eficode.com>2019-07-03 13:55:24 +0300
committerJan Tuomi <jan.tuomi@eficode.com>2019-07-03 13:55:24 +0300
commit44d1990a9947bc4fe9b8bb3902d9aec0441c9f77 (patch)
tree445b0ad5e8c6d679e3472c2c628bc0d586f811c0 /server.js
parenta5cc8ad12ba5ba5450cbcbac289709f9835c4196 (diff)
Implement web UI
Diffstat (limited to 'server.js')
-rw-r--r--server.js19
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}!`))