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-09 09:18:29 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c5c99ac88a55b93894a03593a322dee50635c3b7
c5c99ac8
1 parent
2a700745
Update get data array
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
2 deletions
server.js
server.js
View file @
c5c99ac
...
...
@@ -14,10 +14,13 @@ var url =
"http://apis.data.go.kr/B090041/openapi/service/SpcdeInfoService/"
+
operation
;
var
queryParams
=
"?"
+
"solYear"
+
"="
+
"2022"
;
queryParams
+=
"&"
+
"solMonth"
+
"="
+
"0
5
"
;
queryParams
+=
"&"
+
"solMonth"
+
"="
+
"0
9
"
;
queryParams
+=
"&"
+
"ServiceKey"
+
"="
+
SERVEICE_KEY
;
let
requestUrl
=
url
+
queryParams
;
var
text
=
""
;
var
text2
=
""
;
var
dateName
=
[];
var
locdate
=
[];
app
.
get
(
"/"
,
function
(
req
,
res
)
{
request
.
get
(
requestUrl
,
(
err
,
res
,
body
)
=>
{
...
...
@@ -36,11 +39,37 @@ app.get("/", function (req, res) {
console
.
log
(
res
);
text
=
JSON
.
stringify
(
res
);
console
.
log
(
text
);
dateName
=
[];
var
idx
=
text
.
indexOf
(
"dateName"
,
0
);
while
(
idx
!=
-
1
)
{
console
.
log
(
idx
);
var
start
=
text
.
indexOf
(
"["
,
idx
)
+
2
;
var
end
=
text
.
indexOf
(
"]"
,
idx
)
-
1
;
var
tempStr
=
text
.
substring
(
start
,
end
);
console
.
log
(
tempStr
);
dateName
.
push
(
tempStr
);
idx
=
text
.
indexOf
(
"dateName"
,
idx
+
1
);
}
console
.
log
(
dateName
);
locdate
=
[];
idx
=
text
.
indexOf
(
"locdate"
,
0
);
while
(
idx
!=
-
1
)
{
console
.
log
(
idx
);
var
start
=
text
.
indexOf
(
"["
,
idx
)
+
2
;
var
end
=
text
.
indexOf
(
"]"
,
idx
)
-
1
;
var
tempStr
=
text
.
substring
(
start
,
end
);
console
.
log
(
tempStr
);
locdate
.
push
(
tempStr
);
idx
=
text
.
indexOf
(
"locdate"
,
idx
+
1
);
}
console
.
log
(
locdate
);
text2
=
dateName
.
toString
()
+
"&"
+
locdate
.
toString
();
});
}
}
});
res
.
send
(
text
);
// res.send(text);
res
.
send
(
text2
);
});
const
port
=
8080
;
...
...
Please
register
or
login
to post a comment