본문 바로가기

chatter2

02Feb2020 TIL Express를 사용하지 않고, Node.js 를 사용하여 간단한 서버 구축하기 window.location : 현재 나의 위치 정보를 알 수 있다. 예시)) https://monkeyworld.com/search?keyword=monkey window.location.path => "/search" window.location.search => "?keyword=monkey" 응용 : keyword의 값인 monkey 추출하기 1. 우선 npm의 querystring 모듈을 가져온다. const querystring = require('querystring'); 2. querystring의 .parse() method를 활용하여 keyword의 값을 찾아준다. let search = location.s.. 2020. 2. 3.
28Jan2020 TIL Body.json() :When the fetch is successful, we read and parse the data using json(), then read values out of the resulting objects as you'd expect and insert them into list items to display our product data. (출처 : mdn) fetch(server, { method: "GET", headers: { "Content-Type": "application/json" } }) .then(res => res.json()) .then(json => { app.data = json; return callback !== undefined ? callback.. 2020. 1. 29.