박지환

Add /app get request

......@@ -4,7 +4,6 @@ const request = require("request");
const convert = require("xml-js");
const fs = require("fs");
const xml2js = require("xml2js");
const static = require("serve-static");
// Modify the values as needed
var year = "2022";
......@@ -29,7 +28,6 @@ var tempArr = [];
// To run EJS engine
app.set("views", __dirname + "/views");
app.set("view engine", "ejs");
app.use(static(__dirname));
// To get today date by using Date
function getTodayDate() {
......@@ -173,6 +171,7 @@ function init() {
getData();
}
// Get request for web service
app.get("/", function (req, res) {
init();
// Send data from nodejs to ejs
......@@ -186,6 +185,14 @@ app.get("/", function (req, res) {
res.sendFile(__dirname + "/views/data.ejs");
});
// Get request for app service(Send main data)
app.get("/app", function (req, res) {
init();
res.send(
getTodayDate() + "," + tempArr[0] + "," + tempArr[1] + "," + tempArr[2]
);
});
init();
const port = 8080;
......