Commit 750a7171 authored by Kim, Chaerin's avatar Kim, Chaerin
Browse files

상준

parent d08afbf9
...@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment