JavaScript
-
이벤트 루프JavaScript 2023. 1. 12. 02:24
https://meetup.nhncloud.com/posts/89 자바스크립트와 이벤트 루프 : NHN Cloud Meetup 자바스크립트와 이벤트 루프 meetup.nhncloud.com https://www.korecmblog.com/node-js-event-loop/ Node.js 이벤트 루프(Event Loop) 샅샅이 분석하기 글에 들어가기에 앞서 Node.js의 이벤트 루프의 경우 공식 문서에 설명이 부족하고 이에 따라 여러 사람들이 각자 나름대로 분석한 글이 많아 무엇이 이벤트 루프의 정확한 동작인지 알기 힘듭니 www.korecmblog.com 프로그래밍 패턴 더보기 이벤트 루프란 프로그래밍 패턴. V8에서는 외부 이벤트 루프 구현을 플러그인하여 JS 런타임과 함께 작동할 수 있다. Chr..
-
클래스 호이스팅JavaScript/입 속의 검은 잎 2022. 10. 18. 10:52
먼저, 클래스는 함수의 일종이다. 클래서 선언문으로 정의한 클래스는 소스코드 평가과정, 즉 런타임 이전에 먼저 평가되어 함수 객체를 생성한다. 이때 클래스가 평가되어 생성된 함수 객체는 생성자 함수로서 호출할 수 있는 함수, 즉 constructor다. 생성자 함수로서 호출할 수 있는 함수는 함수 정의가 평가되어 함수 객체를 생성하는 시점에 프로토타입도 더불어 생성된다. 프로토타입과 생성자 함수는 단독으로 존재할 수 없고, 언제나 쌍으로 존재하기 때문이다. , 421쪽. const Jedi = ''; { //호이스팅이 발생하지 않는다면 ''이 출력되어야 한다. console.log(typeof Jedi) //ReferenceError: Cannot access 'Jedi' before initializa..
-
에러로그 : winston, morganJavaScript/Exress 2022. 10. 12. 21:23
https://github.com/winstonjs/winston GitHub - winstonjs/winston: A logger for just about everything. A logger for just about everything. Contribute to winstonjs/winston development by creating an account on GitHub. github.com https://www.npmjs.com/package/winston winston A logger for just about everything.. Latest version: 3.8.2, last published: a month ago. Start using winston in your project b..
-
클래스, super, 오버라이딩JavaScript/입 속의 검은 잎 2022. 10. 12. 10:53
const Jedi = function(name, age){ this.name = name; this.age = age; this.isJedi = true; this.force = ()=>{console.log('may the force be with you')}; }; const Anakin = new Jedi('Anakin', 30); console.log(Anakin) class Sith { constructor(name, age){ this.name = name; this.age = age; this.isJedi = false; } force(){ console.log('may the force serve you') }; } const DarthVader = new Sith('DarthVader'..
-
express.urlenconded()JavaScript/Exress 2022. 10. 11. 20:11
헤더에서 규정되는 content-type을 보라. x-www-form-urlencoded 형태를 받는다. 위의 예시는 클라이언트에서 form 태그를 통해 전송되었다. 이 말은 곧, form 태그로 전송되는 값은 express.json() 이 아니라 express.urlexcoded()로 받아야 한다는 것. 더보기 This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser. 내장된 미들웨어. "urlencoded payload"로 들어오는 리퀘스트를 파싱. body-parser 기반. 지금은 express 패키지 안에 body-pa..
-
express.routerJavaScript/Exress 2022. 10. 11. 20:03
const router = express.Router([options]) 새로운 라우터 객체를 찍어낸다. 옵션에 들어갈 수 있는 것들 caseSensitive default 값이 disabled. 그간 열심히 '/posts' 를 '/Posts' 로 쓰지 않기 위해 기울였던 노력은 허사였다네. mergeParams Preserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child’s value take precedence. 라우터 파라미터에 대한 고질적인 이슈. https://inmanustuaspater.tistory.com/115 strict 디폴트는..
-
async/awaitJavaScript/입 속의 검은 잎 2022. 10. 5. 20:27
처음 나를 애먹였던 것은 아마도 await 였다. 몇가지 시시한 요인이 있다. 1.어휘 뜻이 그냥 좀 딜레이를 두겠다는 것 같다, 2.그런데 사용 양상은 마치 딜레이를 없애고 다시 동기화시키는 것 같다. 좀 더 직관적으로 비동기처리를 할 수 있도록, 비동기적 과정을 표면상에서는 생략하도록 만들어진 것이, 오히려 비동기적 사고를 따라가려는 나에게 또다른 에러가 되었던 것 같다. 하여튼 지금은 이렇게 이해한다. 비동기처리를 위한 콜백함수도, 프로미스도, 그리고 저 await도, "오이디푸스"이다. 다른 뜻이 아니라 자기 실현적 예언이라는 틀에서 그렇다. 자기실현적인 콜백, 약속(promise), 잠깐만(await)의 예언적 순간들 말이다. 이것은 서스펜스와 개연성의 원천이며 인류의 보편이기도 하다. 그래서 ..