Toggle navigation
Toggle navigation
This project
Loading...
Sign in
전세계
/
FakerQuiz
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
전세계
2020-06-03 19:42:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c6b0cfbc033988ad1a82767f7cca9362e748ac1d
c6b0cfbc
1 parent
feb7888d
기능: 크롤링한 데이터를 data.json으로 저장
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
.gitignore
app.js
.gitignore
View file @
c6b0cfb
node_modules
package-lock.json
data.json
\ No newline at end of file
...
...
app.js
View file @
c6b0cfb
const
fs
=
require
(
'fs'
);
const
express
=
require
(
'express'
);
const
app
=
express
();
const
port
=
80
;
...
...
@@ -18,6 +19,10 @@ const getHTML = async () => {
getHTML
()
.
then
(
html
=>
{
var
today
=
new
Date
();
var
dateInfo
=
`
${
today
.
getFullYear
()}
/
${
today
.
getMonth
()
+
1
}
/
${
today
.
getDate
()}
`
;
fakerData
[
'date'
]
=
dateInfo
;
const
$
=
cheerio
.
load
(
html
.
data
);
//#region LCK 통산 전적
...
...
@@ -141,7 +146,10 @@ getHTML()
return
fakerData
;
})
.
then
(
res
=>
console
.
log
(
res
));
.
then
(
res
=>
{
console
.
log
(
res
)
fs
.
writeFileSync
(
'data.json'
,
JSON
.
stringify
(
res
));
});
app
.
get
(
'/'
,
(
req
,
res
)
=>
{
res
.
send
(
'Express Test'
);
...
...
Please
register
or
login
to post a comment