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
750a7171
Commit
750a7171
authored
Jan 18, 2021
by
Kim, Chaerin
Browse files
상준
parent
d08afbf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/controllers/review.controller.js
View file @
750a7171
...
@@ -20,7 +20,7 @@ const search = async (req, res, next) => {
...
@@ -20,7 +20,7 @@ const search = async (req, res, next) => {
const
searchParams
=
new
URLSearchParams
(
$1
(
this
).
find
(
'
a
'
).
attr
(
'
href
'
));
const
searchParams
=
new
URLSearchParams
(
$1
(
this
).
find
(
'
a
'
).
attr
(
'
href
'
));
const
link
=
searchParams
.
get
(
"
/url?q
"
)
const
link
=
searchParams
.
get
(
"
/url?q
"
)
const
summary
=
$1
(
this
).
find
(
'
.s3v9rd
'
).
find
(
'
.s3v9rd
'
).
text
()
const
summary
=
$1
(
this
).
find
(
'
.s3v9rd
'
).
find
(
'
.s3v9rd
'
).
text
()
content
.
push
(
getReview
(
title
,
link
,
summary
))
content
.
push
(
getReview
(
link
))
if
(
title
)
{
if
(
title
)
{
reviews
[
i
]
=
{
title
:
title
,
link
:
link
}
reviews
[
i
]
=
{
title
:
title
,
link
:
link
}
}
else
if
(
summary
)
{
}
else
if
(
summary
)
{
...
@@ -29,12 +29,9 @@ const search = async (req, res, next) => {
...
@@ -29,12 +29,9 @@ const search = async (req, res, next) => {
}
}
})
})
const
promiseReview
=
await
Promise
.
all
(
content
)
const
promiseReview
=
await
Promise
.
all
(
content
)
reviews
.
forEach
((
review
,
i
)
=>
{
reviews
.
forEach
(
async
(
review
,
i
)
=>
{
review
[
"
content
"
]
=
promiseReview
[
i
]
review
[
"
content
"
]
=
promiseReview
[
i
]
})
})
// reviews = { ...reviews, ...promiseReview }
console
.
log
(
"
reviews
"
,
reviews
)
// console.log(promiseReview)
res
.
send
(
reviews
)
res
.
send
(
reviews
)
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
...
@@ -42,7 +39,7 @@ const search = async (req, res, next) => {
...
@@ -42,7 +39,7 @@ const search = async (req, res, next) => {
}
}
}
}
const
getReview
=
async
(
title
,
link
,
summary
)
=>
{
const
getReview
=
async
(
link
)
=>
{
let
content
=
'
없음
'
let
content
=
'
없음
'
if
(
link
)
{
if
(
link
)
{
const
res
=
await
axios
.
get
(
link
)
const
res
=
await
axios
.
get
(
link
)
...
...
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