Toggle navigation
Toggle navigation
This project
Loading...
Sign in
teamPARK
/
holiday-counter-recommend-activity
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박지환
2022-05-27 04:36:03 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
71b1284e1da6a41f63c0611240c4ba174a8e4c3d
71b1284e
1 parent
babde917
Add /app get request
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
server.js
server.js
View file @
71b1284
...
...
@@ -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
;
...
...
Please
register
or
login
to post a comment