aboutsummaryrefslogtreecommitdiffstats
path: root/server.js
blob: cdd7ebb9d28e912b5d9dc1595f5d0abeaf6b65ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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}!`))