repl.it
@nithinthampi/

PeriodicBraveClients

Nodejs

No description

fork
loading
Files
  • index.js
  • Packager files
  • package-lock.json
  • package.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const express = require("express");
const xml2js =  require("xml2js");
const cors = require("cors");

const app  = express();

app.use(cors());

var obj = {
  urlset: {
    $: {
      xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9"
    },
    url: [
      {
        loc: "http://localhost:3000/",
        changefreq: "monthly",
        priority: 1
      },
      {
        loc: "http://localhost:4000" + "/data-privacy",
        changefreq: "monthly",
        priority: 0.5
      }
    ]
  }
};

var builder = new xml2js.Builder({
  xmldec: { version: "1.0", encoding: "UTF-8" }
});
var xml = builder.buildObject(obj);


app.get("/", (req, res) => {
    res.header("Content-Type", "text/xml").send(xml);
})


app.listen(6000, () => {
    console.log("Server started successfully");
})