inflearn logo
Course

Course

Instructor

jaeyoung Lee's Posts

jaeyoung Lee jaeyoung Lee

@wpdud1221

Reviews Written
-
Average Rating
-

Posts 6

Q&A

강사님 질문이있습니다.

강사님 들은 수업 기반으로 프론트 + 백엔드 합쳐서 토이프로젝트 진행중에 막히는점을 질문 드려도괜찮을까요? 다름이아니구 제가 카카오에서 사용하는 좌표 x, y 를 사용하기위해서 mysql db에 저장된 400 ,500 건정도 row를 조회후 x, y만 가져와서 테이블에 업데이트 해주려고 하는데 이 요청을보내면 429 Too Many Requests 오류가뜨고 for문도 첫번째는 돌아서 업데이트가 되긴하는데 이점은 해결방법이 있나요? for ( var i in noLocationList ){ const option = { url : `https://dapi.kakao.com/v2/local/search/address.json?query= ${ encodeURI ( noLocationList [ i ][ 'address' ]) } ` , methods : 'GET' , headers : { Authorization : 'KakaoAK 064940e08c54717d89d8728298c08b71' }, // query : noLocationList[0]['address'] } request ( option , async ( error , response ) => { console . log ( "호출" ) console . log ( "에러내용" , error ); console . log ( response ); if ( error ) new Error ( '400' ); // console.log("===========몇번쨰리퀘스트???",i); var result = JSON . parse ( response . body ); // result.documents[0].x // result.documents[0].y // var jsonVal = xmlToJson(response.body); // console.log(jsonVal); await ApartmentPrice . update ({ xlocation : result . documents [ 0 ]. x , ylocation : result . documents [ 0 ]. y }, { where : { id : noLocationList [ i ][ 'id' ]}}) }) }

Likes
0
Comments
4
Viewcount
383

Q&A

강사님 질문이있습니다.

if ( testVal [ i ][ 'as1' ]=== undefined ) { testVal [ i ][ 'as1' ]={ _text : '' } } 객체 가 비었을시 value가 빈값을 세팅해주어서 해당문제 해결했습니다.

Likes
0
Comments
4
Viewcount
383

Q&A

강사님 질문이있습니다.

해당문제는 JSON.parse(test)로 해결했습니다. 강사님 질문이있는데요 for ( i in testVal ){ // console.log(testVal[i]['kaptName']['_text']) // console.log(testVal[i]['as1']['_text']); // console.log(testVal[i]['as2']['_text']); // console.log(testVal[i]['as3']['_text']); // console.log(testVal[i].as4._text); Apartment . create ({ kaptName : testVal [ i ][ 'kaptName' ][ '_text' ], as1 : testVal [ i ][ 'as1' ][ '_text' ], // as2 : testVal[i]['as2']['_text'], as3 : testVal [ i ][ 'as3' ][ '_text' ], // as4 : testVal[i]['as4']['_text'] || '', }); 현재 testVal[i].as4가 required가 false라서 빈값이 올수도있는데 이런게 오류가 안되게하려면 어떻게 처리해줘야하나요? 그리고 여러가지 문 시퀄라이즈는 promise.allsettled 혹은 promise.all써줘야할까요?

Likes
0
Comments
4
Viewcount
383