Commit bc54f42c authored by baesangjune's avatar baesangjune
Browse files

커밋

parent 1bd65831
import Places from '../models/Place.js'
import cheerio from 'cheerio'
import fs from 'fs'
import axios from 'axios';
import { nextTick } from 'process';
const searchPlace = async (req, res, next,) => {
......@@ -23,7 +25,9 @@ const searchPlace = async (req, res, next,) => {
})
req.places = places
}
next()
}
const searchImg = async (req, res, next) => {
......@@ -43,32 +47,23 @@ const searchImg = async (req, res, next) => {
let $1 = cheerio.load(html);
let images = $1('.RAyV4b').find('img').attr('src')
req.places.img = images
<<<<<<< HEAD
=======
console.log("4141414141414141", req.places)
//사진만 업데이트
// let Place2 = await Places.findOne({ name: req.query.keyword })
>>>>>>> origin/cherry
req.places.times.push(new Date().toLocaleString())
const newPlaces = await new Places(req.places).save()
next()
})
} else {
console.log("이미지 생성 오류발생!!")
}
}
const searchAssociation = async (req, res) => {
let Place3 = req.places.address
if (!Place3) {
<<<<<<< HEAD
=======
console.log("asdfasdfasdf222222222222222222dsaf2222222222214123q5", Place3)
>>>>>>> origin/cherry
res.send({ error: "Place.address is null" })
}
else {
let addresse = Place3.split(' ')[0]
let AssociationsId = []
let addressPlaces = new RegExp(`${addresse}`)
let responsePlaces = await Places.find({ address: addressPlaces }).sort({ updatedAt: -1 })
res.send(responsePlaces)
......@@ -76,4 +71,4 @@ const searchAssociation = async (req, res) => {
}
export default { searchImg, searchPlace, searchAssociation }
export default { searchImg, searchPlace, searchAssociation }
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