Node js 4일차

00_8_3·2020년 11월 6일
0

간단 Node

목록 보기
5/27

Node js 4일차

1. Listing notes

생략

2. Reading notes

filter // 모든 array를 다 실행
find // 조건을 만족하는 첫 번째 array 만나면 종료
const duplicateNote = note.find((note)=>note.title === title)
if (!duplicateNote) {

	...
}

3. Debugging

debugger

>>> node inspect app.js add --title="title" --body="body"
or
>>> node --inspect-brk app.js add --title="title" --body="body"

chrome://inspect
접속

4. Async && HTTP request

날씨api

http://api.weatherstack.com/current?
access_key=5e4d08c131323a07523749d81ece0a73&query=seoul

request npm

>>>npm i request@2.88.1-postman.27
or
>>>npm i postaman-request

const request = require("postman-request")
const url = ""

//json: true 설정은 자동으로 array로 parse 해줌
request({url: url, json: true},(err, res)=>{

    //console.log(res.body.current)
})

0개의 댓글