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-13 11:18:05 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e3244b836d96bea85821d3a94f38534dbb8081b7
e3244b83
1 parent
e794b3b9
Update get data initially
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
server.js
server.js
View file @
e3244b8
...
...
@@ -31,7 +31,7 @@ var tempArr = [];
app
.
set
(
"views"
,
__dirname
+
"/views"
);
app
.
set
(
"view engine"
,
"ejs"
);
app
.
get
(
"/"
,
function
(
req
,
res
)
{
function
init
(
)
{
request
.
get
(
requestUrl
,
(
err
,
res
,
body
)
=>
{
if
(
err
)
{
console
.
log
(
"err => "
+
err
);
...
...
@@ -84,6 +84,10 @@ app.get("/", function (req, res) {
}
}
});
}
app
.
get
(
"/"
,
function
(
req
,
res
)
{
init
();
// Send data from nodejs to ejs
res
.
render
(
"data.ejs"
,
{
data
:
tempArr
},
function
(
err
,
html
)
{
if
(
err
)
{
...
...
@@ -95,5 +99,7 @@ app.get("/", function (req, res) {
res
.
sendFile
(
__dirname
+
"/views/data.ejs"
);
});
init
();
const
port
=
8080
;
app
.
listen
(
port
,
()
=>
console
.
log
(
"Listening on port "
+
port
));
...
...
Please
register
or
login
to post a comment