Commit 15de371e authored by Kim, Chaerin's avatar Kim, Chaerin
Browse files

리뷰 완벽

parent 32ab85d9
[{"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Bookmark.js":"1","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js":"2","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js":"3","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Place.js":"4"},{"size":5288,"mtime":1612154335893,"results":"5","hashOfConfig":"6"},{"size":6632,"mtime":1612152098441,"results":"7","hashOfConfig":"6"},{"size":8073,"mtime":1612153255044,"results":"8","hashOfConfig":"6"},{"size":6328,"mtime":1612149747278,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":12,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"1n20xnc",{"filePath":"12","messages":"13","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"14","messages":"15","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"16","messages":"17","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Bookmark.js",["18","19","20","21","22","23","24","25","26","27","28","29"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js",["30"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js",["31","32","33","34","35"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Place.js",["36","37","38","39"],{"ruleId":"40","severity":1,"message":"41","line":2,"column":45,"nodeType":"42","messageId":"43","endLine":2,"endColumn":48},{"ruleId":"40","severity":1,"message":"44","line":2,"column":50,"nodeType":"42","messageId":"43","endLine":2,"endColumn":56},{"ruleId":"40","severity":1,"message":"45","line":17,"column":12,"nodeType":"42","messageId":"43","endLine":17,"endColumn":16},{"ruleId":"40","severity":1,"message":"46","line":17,"column":18,"nodeType":"42","messageId":"43","endLine":17,"endColumn":25},{"ruleId":"40","severity":1,"message":"47","line":18,"column":12,"nodeType":"42","messageId":"43","endLine":18,"endColumn":17},{"ruleId":"40","severity":1,"message":"48","line":18,"column":19,"nodeType":"42","messageId":"43","endLine":18,"endColumn":27},{"ruleId":"40","severity":1,"message":"49","line":19,"column":12,"nodeType":"42","messageId":"43","endLine":19,"endColumn":17},{"ruleId":"40","severity":1,"message":"50","line":20,"column":12,"nodeType":"42","messageId":"43","endLine":20,"endColumn":17},{"ruleId":"40","severity":1,"message":"51","line":20,"column":19,"nodeType":"42","messageId":"43","endLine":20,"endColumn":27},{"ruleId":"40","severity":1,"message":"52","line":23,"column":12,"nodeType":"42","messageId":"43","endLine":23,"endColumn":19},{"ruleId":"40","severity":1,"message":"53","line":23,"column":21,"nodeType":"42","messageId":"43","endLine":23,"endColumn":31},{"ruleId":"54","severity":1,"message":"55","line":65,"column":8,"nodeType":"56","endLine":65,"endColumn":10,"suggestions":"57"},{"ruleId":"40","severity":1,"message":"58","line":4,"column":64,"nodeType":"42","messageId":"43","endLine":4,"endColumn":68},{"ruleId":"40","severity":1,"message":"41","line":4,"column":83,"nodeType":"42","messageId":"43","endLine":4,"endColumn":86},{"ruleId":"40","severity":1,"message":"49","line":22,"column":12,"nodeType":"42","messageId":"43","endLine":22,"endColumn":17},{"ruleId":"54","severity":1,"message":"59","line":63,"column":8,"nodeType":"56","endLine":63,"endColumn":15,"suggestions":"60"},{"ruleId":"40","severity":1,"message":"61","line":133,"column":9,"nodeType":"42","messageId":"43","endLine":133,"endColumn":13},{"ruleId":"62","severity":1,"message":"63","line":138,"column":35,"nodeType":"64","endLine":138,"endColumn":76},{"ruleId":"40","severity":1,"message":"65","line":1,"column":10,"nodeType":"66","messageId":"43","endLine":1,"endColumn":15},{"ruleId":"40","severity":1,"message":"67","line":4,"column":21,"nodeType":"42","messageId":"43","endLine":4,"endColumn":24},{"ruleId":"54","severity":1,"message":"68","line":55,"column":6,"nodeType":"56","endLine":55,"endColumn":8,"suggestions":"69"},{"ruleId":"70","severity":1,"message":"71","line":134,"column":11,"nodeType":"72","endLine":134,"endColumn":23},"no-unused-vars","'Nav' is defined but never used.","Identifier","unusedVar","'Navbar' is defined but never used.","'page' is assigned a value but never used.","'setPage' is assigned a value but never used.","'index' is assigned a value but never used.","'setIndex' is assigned a value but never used.","'error' is assigned a value but never used.","'state' is assigned a value but never used.","'setState' is assigned a value but never used.","'showSet' is assigned a value but never used.","'setShowSet' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getBookmark'. Either include it or remove the dependency array.","ArrayExpression",["73"],"'Card' is defined but never used.","React Hook useEffect has missing dependencies: 'getAssociation', 'getBookmark', 'props.history', and 'search'. Either include them or remove the dependency array.",["74"],"'time' is assigned a value but never used.","react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'kakao' is defined but never used.","Program","'Row' is defined but never used.","React Hook useEffect has missing dependencies: 'getReview' and 'infiniteScroll'. Either include them or remove the dependency array.",["75"],"jsx-a11y/anchor-is-valid","The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement",{"desc":"76","fix":"77"},{"desc":"78","fix":"79"},{"desc":"80","fix":"81"},"Update the dependencies array to be: [getBookmark]",{"range":"82","text":"83"},"Update the dependencies array to be: [getAssociation, getBookmark, props.history, search, state]",{"range":"84","text":"85"},"Update the dependencies array to be: [getReview, infiniteScroll]",{"range":"86","text":"87"},[2281,2283],"[getBookmark]",[2424,2431],"[getAssociation, getBookmark, props.history, search, state]",[1815,1817],"[getReview, infiniteScroll]"]
\ No newline at end of file
[{"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Bookmark.js":"1","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js":"2","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js":"3","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Place.js":"4","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Components\\PrivateRoute.js":"5"},{"size":5286,"mtime":1612155520769,"results":"6","hashOfConfig":"7"},{"size":6708,"mtime":1612155591498,"results":"8","hashOfConfig":"7"},{"size":7168,"mtime":1612283646128,"results":"9","hashOfConfig":"7"},{"size":3297,"mtime":1612285146196,"results":"10","hashOfConfig":"7"},{"size":438,"mtime":1611896266513,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":12,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"1n20xnc",{"filePath":"14","messages":"15","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"16","messages":"17","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"18","messages":"19","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Bookmark.js",["22","23","24","25","26","27","28","29","30","31","32","33"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js",["34"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js",["35","36","37","38","39"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Place.js",["40","41","42","43"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Components\\PrivateRoute.js",[],{"ruleId":"44","severity":1,"message":"45","line":2,"column":45,"nodeType":"46","messageId":"47","endLine":2,"endColumn":48},{"ruleId":"44","severity":1,"message":"48","line":2,"column":50,"nodeType":"46","messageId":"47","endLine":2,"endColumn":56},{"ruleId":"44","severity":1,"message":"49","line":17,"column":12,"nodeType":"46","messageId":"47","endLine":17,"endColumn":16},{"ruleId":"44","severity":1,"message":"50","line":17,"column":18,"nodeType":"46","messageId":"47","endLine":17,"endColumn":25},{"ruleId":"44","severity":1,"message":"51","line":18,"column":12,"nodeType":"46","messageId":"47","endLine":18,"endColumn":17},{"ruleId":"44","severity":1,"message":"52","line":18,"column":19,"nodeType":"46","messageId":"47","endLine":18,"endColumn":27},{"ruleId":"44","severity":1,"message":"53","line":19,"column":12,"nodeType":"46","messageId":"47","endLine":19,"endColumn":17},{"ruleId":"44","severity":1,"message":"54","line":20,"column":12,"nodeType":"46","messageId":"47","endLine":20,"endColumn":17},{"ruleId":"44","severity":1,"message":"55","line":20,"column":19,"nodeType":"46","messageId":"47","endLine":20,"endColumn":27},{"ruleId":"44","severity":1,"message":"56","line":23,"column":12,"nodeType":"46","messageId":"47","endLine":23,"endColumn":19},{"ruleId":"44","severity":1,"message":"57","line":23,"column":21,"nodeType":"46","messageId":"47","endLine":23,"endColumn":31},{"ruleId":"58","severity":1,"message":"59","line":65,"column":8,"nodeType":"60","endLine":65,"endColumn":10,"suggestions":"61"},{"ruleId":"44","severity":1,"message":"62","line":4,"column":64,"nodeType":"46","messageId":"47","endLine":4,"endColumn":68},{"ruleId":"44","severity":1,"message":"45","line":4,"column":83,"nodeType":"46","messageId":"47","endLine":4,"endColumn":86},{"ruleId":"44","severity":1,"message":"53","line":23,"column":12,"nodeType":"46","messageId":"47","endLine":23,"endColumn":17},{"ruleId":"58","severity":1,"message":"63","line":57,"column":8,"nodeType":"60","endLine":57,"endColumn":15,"suggestions":"64"},{"ruleId":"44","severity":1,"message":"65","line":112,"column":9,"nodeType":"46","messageId":"47","endLine":112,"endColumn":13},{"ruleId":"66","severity":1,"message":"67","line":117,"column":35,"nodeType":"68","endLine":117,"endColumn":76},{"ruleId":"44","severity":1,"message":"69","line":1,"column":10,"nodeType":"70","messageId":"47","endLine":1,"endColumn":15},{"ruleId":"44","severity":1,"message":"53","line":11,"column":10,"nodeType":"46","messageId":"47","endLine":11,"endColumn":15},{"ruleId":"58","severity":1,"message":"71","line":30,"column":6,"nodeType":"60","endLine":30,"endColumn":8,"suggestions":"72"},{"ruleId":"73","severity":1,"message":"74","line":90,"column":11,"nodeType":"75","endLine":90,"endColumn":44},"no-unused-vars","'Nav' is defined but never used.","Identifier","unusedVar","'Navbar' is defined but never used.","'page' is assigned a value but never used.","'setPage' is assigned a value but never used.","'index' is assigned a value but never used.","'setIndex' is assigned a value but never used.","'error' is assigned a value but never used.","'state' is assigned a value but never used.","'setState' is assigned a value but never used.","'showSet' is assigned a value but never used.","'setShowSet' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getBookmark'. Either include it or remove the dependency array.","ArrayExpression",["76"],"'Card' is defined but never used.","React Hook useEffect has missing dependencies: 'getAssociation', 'getBookmark', 'props.history', and 'search'. Either include them or remove the dependency array.",["77"],"'time' is assigned a value but never used.","react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'kakao' is defined but never used.","Program","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.",["78"],"jsx-a11y/anchor-is-valid","The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement",{"desc":"79","fix":"80"},{"desc":"81","fix":"82"},{"desc":"83","fix":"84"},"Update the dependencies array to be: [getBookmark]",{"range":"85","text":"86"},"Update the dependencies array to be: [getAssociation, getBookmark, props.history, search, state]",{"range":"87","text":"88"},"Update the dependencies array to be: [getReview]",{"range":"89","text":"90"},[2281,2283],"[getBookmark]",[2158,2165],"[getAssociation, getBookmark, props.history, search, state]",[1055,1057],"[getReview]"]
\ No newline at end of file
/*global kakao*/
import axios from 'axios';
import React, { useEffect, useState } from 'react';
import { Container, Row, Image } from 'react-bootstrap';
import { Container, Row, Image, Col } from 'react-bootstrap';
import queryString from 'query-string'
import { Link } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG';
import catchErrors from '../utils/catchErrors';
function Place(props) {
console.log(props)
const [db, setDb] = useState(false)
const [index, setIndex] = useState(0)
const [reviews, setReviews] = useState([])
const place = queryString.parse(props.location.search).place
const getReview = (index) => {
console.log(index, "dlseprtm")
axios({ url: `/api/review?keyword=${place}&index=${index}`, method: 'post', data: { db: db } })
.then(res => {
const [error, setError] = useState('')
const [review, setReviews] = useState({ reviews: [], db: false, index: 0 })
const { name, src, address } = queryString.parse(props.location.search)
console.log(review)
const getReview = async () => {
try {
setError('')
const res = await axios({ url: `/api/review?keyword=${name}&index=${review.index}`, method: 'post', data: { db: review.db } })
console.log("place res.data", res.data)
setReviews([...reviews, ...res.data.review])
setDb(res.data.db)
setIndex(res.data.index)
})
.then(() => {
console.log(index, "인텍스", db)
})
.catch(err => {
console.log(err)
})
setReviews({ reviews: [...review.reviews, ...res.data.review], db: res.data.db, index: res.data.index })
} catch (error) {
catchErrors(error, setError)
}
}
useEffect(() => {
// const script = document.createElement("script");
// script.async = true;
// script.src =
// "https://dapi.kakao.com/v2/maps/sdk.js?appkey=908d6cabedae3bbac126305e53137d0d&autoload=false";
// document.head.appendChild(script);
// script.onload = () => {
// kakao.maps.load(() => {
// let container = document.getElementById("Mymap");
// let options = {
// center: new kakao.maps.LatLng(37.506502, 127.053617),
// level: 7
// };
// const map = new window.kakao.maps.Map(container, options);
// });
// }
useEffect(() => {
getReview();
window.addEventListener("scroll", infiniteScroll);
return () => { window.removeEventListener("scroll", infiniteScroll); }
}, []);
// useEffect(() => {
// getReview();
// }, [index])
const infiniteScroll = () => {
const { documentElement, body } = document;
const scrollHeight = Math.max(documentElement.scrollHeight, body.scrollHeight);
const scrollTop = Math.max(documentElement.scrollTop, body.scrollTop);
const clientHeight = documentElement.clientHeight;
if (scrollTop + clientHeight >= scrollHeight) {
// setIndex(index + 1)
getReview(index + 1);
console.log("더불러", index + 1)
}
console.log(scrollHeight, scrollTop, clientHeight)
}
return (
<Container>
<Link to="/" className="d-flex justify-content-center"><Image src={ohuh} /></Link>
<Link to="/"><Image src={ohuh} /></Link>
<div class="d-flex align-items-center p-3 my-3 text-white bg-info rounded shadow-sm">
<div >
<h1 class="h6 mb-0 text-white">{place}</h1>
<h1 class="h6 mb-0 text-white">{name}</h1>
</div>
</div>
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom pb-2 mb-0">관광지 정보</h6>
{/* <MapContents id="Mymap"></MapContents> */}
{/* <div class="d-flex text-muted pt-3">
<p class="pb-3 mb-0 small lh-sm border-bottom">
<strong class="d-block text-gray-dark">@username</strong>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
<Row>
<Col>
<Image variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={src} />
</Col>
<Col>
<div class="d-flex text-muted pt-3">
<p class="pb-3 mb-0 lh-sm border-bottom">
<strong class="d-block text-gray-dark">관광지 이름</strong>
{name}
</p>
</div>
<div class="d-flex text-muted pt-3">
<svg class="bd-placeholder-img flex-shrink-0 me-2 rounded" width="32" height="32" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 32x32" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#e83e8c" /><text x="50%" y="50%" fill="#e83e8c" dy=".3em">32x32</text></svg>
<p class="pb-3 mb-0 small lh-sm border-bottom">
<strong class="d-block text-gray-dark">@username</strong>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
<p class="pb-3 mb-0 lh-sm border-bottom">
<strong class="d-block text-gray-dark">관광지 주소</strong>
{address}
</p>
</div>
<div class="d-flex text-muted pt-3">
<svg class="bd-placeholder-img flex-shrink-0 me-2 rounded" width="32" height="32" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 32x32" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#6f42c1" /><text x="50%" y="50%" fill="#6f42c1" dy=".3em">32x32</text></svg>
</Col>
</Row>
<p class="pb-3 mb-0 small lh-sm border-bottom">
<strong class="d-block text-gray-dark">@username</strong>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
</p>
</div> */}
<small class="d-block text-end mt-3">
<a href={`https://www.google.com/search?q=${place}&tbm=isch`}>사진 더보러가기</a>
<a href={`https://www.google.com/search?q=${name}&tbm=isch`}>사진 더보러가기</a>
</small>
</div>
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom pb-2 mb-0">관광지 후기</h6>
{Array.isArray(reviews) ? reviews.map((review, index) => {
{Array.isArray(review.reviews) ? review.reviews.map((review) => {
return (
<div class="d-flex text-muted pt-3">
<div class="pb-3 mb-0 small lh-sm border-bottom w-100">
......@@ -130,25 +85,12 @@ function Place(props) {
: "리뷰가 없습니다."}
<small class="d-block text-end mt-3">
<a href="#">리뷰 더보기</a>
<a href="#" onClick={getReview} >리뷰 더보기</a>
</small>
</div>
</Container>
// <Container {...props}>
// {place}
// {Array.isArray(reviews) ? reviews.map((review, index) => {
// return (
// <Row className="mt-4">
// <a href={review.link}>{review.title}</a>
// <div>{review.summary}</div>
// <div>{review.content}</div>
// </Row>
// )
// })
// : "리뷰가 없습니다."}
// </Container>
);
}
......
......@@ -12,7 +12,6 @@ import _ from 'lodash';
function Search(props) {
const [state, setState] = useState(false);
const [index, setIndex] = useState(1);
const [search, setSearch] = useState(queryString.parse(props.location.search).keyword);
......
......@@ -2,66 +2,53 @@ import Review from '../models/Review.js'
import cheerio from "cheerio";
import axios from 'axios';
const search = async (req, res) => {
const search = async (req, res, next) => {
let DuplicateCheckReview = []
if (!req.body.db) { DuplicateCheckReview = await Review.find({ keyword: req.query.keyword }) }
if (!req.body.db && DuplicateCheckReview !== []) {
req.review = DuplicateCheckReview
} else {
try {
let reviews = []
console.log(req.reviews, "제발")
let url = "https://www.google.com/search?q=" + encodeURI(req.query.keyword) + `+site%3Atistory.com&start=${Number(req.query.index) * 10}`
console.log(url)
let response1 = await axios.get(url)
let $1 = cheerio.load(response1.data);
$1('.kCrYT').each(async function (i) {
console.log("3")
let title = $1(this).find('h3').text()
let searchParams = new URLSearchParams($1(this).find('a').attr('href'));
let link = searchParams.get("/url?q")
let summary = $1(this).find('.s3v9rd').find('.s3v9rd').text()
if (title) {
reviews[i] = { title: title, link: link }
reviews[i] = { title: title, link: link, keyword: [req.query.keyword] }
} else if (summary) {
reviews[i - 1] = { ...reviews[i - 1], summary: summary }
reviews = reviews.filter(e => e)
}
})
// reviews.forEach(async (review, i) => {
// await Review.updateOne({ link: review.link }, { $push: { bookmark: req.query.keyword } })
// const reviewss = await Review.findOne({ link: review.link })
// if (!reviewss) {
// // reviews["keyword"] = [req.query.keyword]
let newReviews = []
newReviews = [...newReviews, ...reviews]
// await new Review(review).save()
// }
// })
// console.log(req.reviews, "걸러낸 리뷰즈입니다")
// const a = await Promise.all(newReviews)
// console.log(a, "2")
console.log(req.query.index, "인덱스ㅡㅡ")
res.status(200).send({ review: newReviews, db: true, index: Number(req.query.index) + 1 })
req.review = reviews
} catch (error) {
console.log("6")
console.log(error)
}
}
next()
}
const find = async(req, res, next) => {
console.log("7", req.query)
const keyword = req.query.keyword
if (req.body.db) {
next()
const save = async (req, res) => {
req.review.forEach(async (reviews, i) => {
const review = await Review.findOne({ link: reviews.link })
if (review) {
await Review.updateOne({ link: reviews.link }, { $push: { bookmark: req.query.keyword } })
req.review[i] = ""
}
await Review.find({ keyword: keyword }, function (err, reviews) {
req.reviews = []
if (reviews) {
if (reviews.length > 5) {
res.status(200).send({ review: reviews, db: true, message: "제발용" })
else {
await new Review(reviews).save()
}
req.reviews = reviews
}
next()
})
console.log(req.review.length)
req.review = req.review.filter(e => e)
console.log(req.review.length)
res.status(200).send({ review: req.review, db: true, index: Number(req.query.index) + 1 })
}
export default { search, find }
export default { search, save }
......@@ -48,7 +48,6 @@ const userById = async (req, res, next, id) => {
const getBookmark = async (req, res) => {
await User.findOne({ _id: req.query.ID }).populate('bookmark').exec((err, bookmark) => {
console.log(bookmark, "dkssud")
res.send(bookmark)
})
}
......
......@@ -4,6 +4,6 @@ import review from '../controllers/review.controller.js'
const router = express.Router()
router.route('/api/review')
.post(review.find, review.search)
.post(review.search, review.save)
export default router
\ No newline at end of file
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