Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
search-page
Commits
3695b9ca
Commit
3695b9ca
authored
Jan 13, 2021
by
Lee SeoYeon
Browse files
.
parent
1f388bc8
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
client/.eslintcache
View file @
3695b9ca
This diff is collapsed.
Click to expand it.
package-lock.json
View file @
3695b9ca
...
...
@@ -159,6 +159,11 @@
"type-is"
:
"~1.6.17"
}
},
"boolbase"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz"
,
"integrity"
:
"sha1-aN/1++YMUes3cl6p4+0xDcwed24="
},
"boxen"
:
{
"version"
:
"4.2.0"
,
"resolved"
:
"https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz"
,
...
...
@@ -301,6 +306,32 @@
}
}
},
"cheerio"
:
{
"version"
:
"1.0.0-rc.5"
,
"resolved"
:
"https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.5.tgz"
,
"integrity"
:
"sha512-yoqps/VCaZgN4pfXtenwHROTp8NG6/Hlt4Jpz2FEP0ZJQ+ZUkVDd0hAPDNKhj3nakpfPt/CNs57yEtxD1bXQiw=="
,
"requires"
:
{
"cheerio-select-tmp"
:
"^0.1.0"
,
"dom-serializer"
:
"~1.2.0"
,
"domhandler"
:
"^4.0.0"
,
"entities"
:
"~2.1.0"
,
"htmlparser2"
:
"^6.0.0"
,
"parse5"
:
"^6.0.0"
,
"parse5-htmlparser2-tree-adapter"
:
"^6.0.0"
}
},
"cheerio-select-tmp"
:
{
"version"
:
"0.1.1"
,
"resolved"
:
"https://registry.npmjs.org/cheerio-select-tmp/-/cheerio-select-tmp-0.1.1.tgz"
,
"integrity"
:
"sha512-YYs5JvbpU19VYJyj+F7oYrIE2BOll1/hRU7rEy/5+v9BzkSo3bK81iAeeQEMI92vRIxz677m72UmJUiVwwgjfQ=="
,
"requires"
:
{
"css-select"
:
"^3.1.2"
,
"css-what"
:
"^4.0.0"
,
"domelementtype"
:
"^2.1.0"
,
"domhandler"
:
"^4.0.0"
,
"domutils"
:
"^2.4.4"
}
},
"chokidar"
:
{
"version"
:
"3.5.0"
,
"resolved"
:
"https://registry.npmjs.org/chokidar/-/chokidar-3.5.0.tgz"
,
...
...
@@ -409,6 +440,23 @@
"resolved"
:
"https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz"
,
"integrity"
:
"sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA=="
},
"css-select"
:
{
"version"
:
"3.1.2"
,
"resolved"
:
"https://registry.npmjs.org/css-select/-/css-select-3.1.2.tgz"
,
"integrity"
:
"sha512-qmss1EihSuBNWNNhHjxzxSfJoFBM/lERB/Q4EnsJQQC62R2evJDW481091oAdOr9uh46/0n4nrg0It5cAnj1RA=="
,
"requires"
:
{
"boolbase"
:
"^1.0.0"
,
"css-what"
:
"^4.0.0"
,
"domhandler"
:
"^4.0.0"
,
"domutils"
:
"^2.4.3"
,
"nth-check"
:
"^2.0.0"
}
},
"css-what"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/css-what/-/css-what-4.0.0.tgz"
,
"integrity"
:
"sha512-teijzG7kwYfNVsUh2H/YN62xW3KK9YhXEgSlbxMlcyjPNvdKJqFx5lrwlJgoFP1ZHlB89iGDlo/JyshKeRhv5A=="
},
"debug"
:
{
"version"
:
"2.6.9"
,
"resolved"
:
"https://registry.npmjs.org/debug/-/debug-2.6.9.tgz"
,
...
...
@@ -482,6 +530,39 @@
}
}
},
"dom-serializer"
:
{
"version"
:
"1.2.0"
,
"resolved"
:
"https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.2.0.tgz"
,
"integrity"
:
"sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA=="
,
"requires"
:
{
"domelementtype"
:
"^2.0.1"
,
"domhandler"
:
"^4.0.0"
,
"entities"
:
"^2.0.0"
}
},
"domelementtype"
:
{
"version"
:
"2.1.0"
,
"resolved"
:
"https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz"
,
"integrity"
:
"sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w=="
},
"domhandler"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz"
,
"integrity"
:
"sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA=="
,
"requires"
:
{
"domelementtype"
:
"^2.1.0"
}
},
"domutils"
:
{
"version"
:
"2.4.4"
,
"resolved"
:
"https://registry.npmjs.org/domutils/-/domutils-2.4.4.tgz"
,
"integrity"
:
"sha512-jBC0vOsECI4OMdD0GC9mGn7NXPLb+Qt6KW1YDQzeQYRUFKmNG8lh7mO5HiELfr+lLQE7loDVI4QcAxV80HS+RA=="
,
"requires"
:
{
"dom-serializer"
:
"^1.0.1"
,
"domelementtype"
:
"^2.0.1"
,
"domhandler"
:
"^4.0.0"
}
},
"dot-prop"
:
{
"version"
:
"5.3.0"
,
"resolved"
:
"https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz"
,
...
...
@@ -526,6 +607,11 @@
"once"
:
"^1.4.0"
}
},
"entities"
:
{
"version"
:
"2.1.0"
,
"resolved"
:
"https://registry.npmjs.org/entities/-/entities-2.1.0.tgz"
,
"integrity"
:
"sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
},
"escape-goat"
:
{
"version"
:
"2.1.1"
,
"resolved"
:
"https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz"
,
...
...
@@ -678,6 +764,17 @@
"resolved"
:
"https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz"
,
"integrity"
:
"sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw=="
},
"htmlparser2"
:
{
"version"
:
"6.0.0"
,
"resolved"
:
"https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.0.0.tgz"
,
"integrity"
:
"sha512-numTQtDZMoh78zJpaNdJ9MXb2cv5G3jwUoe3dMQODubZvLoGvTE/Ofp6sHvH8OGKcN/8A47pGLi/k58xHP/Tfw=="
,
"requires"
:
{
"domelementtype"
:
"^2.0.1"
,
"domhandler"
:
"^4.0.0"
,
"domutils"
:
"^2.4.4"
,
"entities"
:
"^2.0.0"
}
},
"http-cache-semantics"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz"
,
...
...
@@ -1151,6 +1248,14 @@
"resolved"
:
"https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz"
,
"integrity"
:
"sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ=="
},
"nth-check"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz"
,
"integrity"
:
"sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q=="
,
"requires"
:
{
"boolbase"
:
"^1.0.0"
}
},
"object-assign"
:
{
"version"
:
"4.1.1"
,
"resolved"
:
"https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
,
...
...
@@ -1195,6 +1300,19 @@
}
}
},
"parse5"
:
{
"version"
:
"6.0.1"
,
"resolved"
:
"https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz"
,
"integrity"
:
"sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
},
"parse5-htmlparser2-tree-adapter"
:
{
"version"
:
"6.0.1"
,
"resolved"
:
"https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz"
,
"integrity"
:
"sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA=="
,
"requires"
:
{
"parse5"
:
"^6.0.1"
}
},
"parseurl"
:
{
"version"
:
"1.3.3"
,
"resolved"
:
"https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz"
,
...
...
package.json
View file @
3695b9ca
...
...
@@ -7,6 +7,7 @@
"dependencies"
:
{
"
axios
"
:
"
^0.21.1
"
,
"
bcryptjs
"
:
"
^2.4.3
"
,
"
cheerio
"
:
"
^1.0.0-rc.5
"
,
"
express
"
:
"
^4.17.1
"
,
"
jsonwebtoken
"
:
"
^8.5.1
"
,
"
mongoose
"
:
"
^5.11.11
"
,
...
...
server/config.js
View file @
3695b9ca
...
...
@@ -2,12 +2,7 @@ const config = {
env
:
process
.
env
.
NODE_ENV
||
'
development
'
,
port
:
process
.
env
.
PORT
||
3001
,
jwtSecret
:
process
.
env
.
JWT_SECRET
||
'
My_Secret_Key
'
,
<<<<<<<
HEAD
mongoDbUri
:
process
.
env
.
MONGODB_URI
||
'
mongodb://localhost/search-page
'
,
cookieMaxAge
:
60
*
60
*
24
*
7
*
1000
=======
mongoDbUri
:
process
.
env
.
MONGODB_URI
||
'
mongodb://localhost/search_page
'
>>>>>>>
origin
/
cherry
}
export
default
config
\ No newline at end of file
server/controllers/review.controller.js
View file @
3695b9ca
...
...
@@ -22,13 +22,6 @@ const search = async (req, res) => {
let
places
=
[]
$
(
'
.kCrYT
'
).
each
(
function
(
i
)
{
const
review
=
await
Review
.
findOne
({
link
:
$
(
this
).
find
(
'
a
'
).
attr
(
'
href
'
)
})
if
(
!
user
)
{
const
newReview
=
await
new
Review
({
name
,
email
,
password
:
hash
}).
save
()
}
places
[
i
]
=
{
title
:
$
(
this
).
find
(
'
h3
'
).
text
(),
link
:
$
(
this
).
find
(
'
a
'
).
attr
(
'
href
'
),
...
...
server/scraper.js
View file @
3695b9ca
<<<<<<<
HEAD
import
cheerio
from
"
cheerio
"
import
express
from
'
express
'
import
request
from
'
request
'
import
axios
from
'
axios
'
const
app
=
express
()
// axios를 활용해 AJAX로 HTML 문서를 가져오는 함수 구현
// getHTML 함수 실행 후 데이터에서
// body > main > div > section > ul > li > article > h2 > a
// 에 속하는 제목을 titleList에 저장
app
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
const
url
=
"
https://section.blog.naver.com/Search/Post.nhn?pageNo=1&rangeType=ALL&orderBy=sim&keyword=%ED%95%9C%EB%9D%BC%EC%82%B0
"
request
(
url
,
function
(
err
,
res
,
html
)
{
console
.
log
(
html
)
if
(
!
err
){
let
$
=
cheerio
.
load
(
html
);
}
}
// .then(html => {
// let titleList = [];
// const $ = cheerio.load(html.data);
// // ul.list--posts를 찾고 그 children 노드를 bodyList에 저장
// const bodyList = $(".title_post > span");
// // bodyList를 순회하며 titleList에 h2 > a의 내용을 저장
// bodyList.each(function (i, elem) {
// titleList[i] = {
// title: $(this)
// .text()
// };
// });
// return titleList;
// })
// .then(res => console.log(res)); // 저장된 결과를 출력
)
=======
import
axios
from
"
axios
"
;
import
cheerio
from
"
cheerio
"
;
import
express
from
'
express
'
;
...
...
@@ -71,7 +31,6 @@ app.get('/', (req, res) => {
const
iconv
=
new
Iconv
(
encoding
,
"
utf-8//translit//ignore
"
);
return
iconv
.
convert
(
str
).
toString
();
}
>>>>>>>
origin
/
cherry
})
app
.
listen
(
3001
,
()
=>
{
...
...
server/server.js
View file @
3695b9ca
import
express
from
'
express
'
<<<<<<<
HEAD
import
connectDb
from
"
./utils/connectDb.js
"
import
userRouter
from
"
./routes/user.routes.js
"
import
authRouter
from
"
./routes/auth.routes.js
"
=======
import
connectDb
from
'
./utils/connectDb.js
'
import
placeRouter
from
'
./routes/place.routes.js
'
import
reviewRouter
from
'
./routes/review.routes.js
'
>>>>>>>
origin
/
cherry
connectDb
()
...
...
@@ -17,10 +11,6 @@ app.use('/images', express.static('uploads/'))
app
.
use
(
express
.
json
())
<<<<<<<
HEAD
app
.
use
(
userRouter
)
app
.
use
(
authRouter
)
=======
app
.
use
(
placeRouter
)
app
.
use
(
reviewRouter
)
...
...
@@ -28,7 +18,6 @@ app.get('/', (req, res) => {
console
.
log
(
"
/ req.body
"
,
req
.
body
)
res
.
json
({
message
:
"
http://localhost3001/ 에 연결됨
"
})
})
>>>>>>>
origin
/
cherry
app
.
listen
(
3001
,
()
=>
{
console
.
log
(
'
Listening on port 3001
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment