10장 미들웨어
미들웨어(개념적) 애플리케이션에 대한 HTTP요청에서 동작하는 기능을 캡슐화 하는방법
현실적으로 말하면 3가지 매개변수를 받는 함수 요청, 응답,next
에러,요청,응답,넥스트
194페이지 까지 읽어봤는데
예상과는 다르다는걸 느꼈다. 읽을수록 자바스크립트 문법에대해 내가 모르는게 많다는걸 느낀다.
객체지향 자바스크립트의 원리
javascript patterns
빠른 시일 내에 이 두 권의 책을 읽어봐야겠다.
5장의 hood-river 테스트 쪽에서 자꾸 Fatal unspecified error 가 나서
직접 테스트를 해보았다.
브라우저에 직접 해당주소를 넣고 엔터를 때리고나서 링크를 손수 클릭해주니
hidden field에 정확히 원하는 값이 들어가있다.
그런데 왜 테스트에서는 정의하지 않은 에러가 나올까?
그래서 console.log(browser.field('referrer'))로 해당 테스트스윗? 에다가 찍어봤더니...
{ _childNodes: { '0': [Object], '1': [Object] },
_ownerDocument: [Circular],
_attributes:
{ _ownerDocument: '#document',
_parentNode: [Circular],
_readonly: false,
'_$ns_to_attrs': {},
'_$name_to_attrs': {},
length: 0 },
_nodeName: '#document',
_childrenList: null,
_version: 341,
_nodeValue: null,
_parentNode: null,
_memoizedQueries: { '2': [Object], '11': [Object], '12': [Object] },
_readonly: false,
_tagName: '#document',
_contentType: 'text/html',
_doctype:
{ _childNodes: {},
_ownerDocument: [Circular],
_attributes: [Object],
_nodeName: 'html',
_childrenList: null,
_version: 0,
_nodeValue: null,
_parentNode: [Circular],
_memoizedQueries: {},
_readonly: false,
_name: 'html',
_tagName: 'html',
_entities: [Object],
_notations: [Object],
_publicId: '',
_systemId: '',
_fullDT: '<!doctype html>',
toString: [Function] },
_implementation: { _ownerDocument: undefined, _features: [Object] },
_documentElement:
{ _ownerDocument: [Circular],
_childNodes: [Object],
_attributes: [Object],
_nodeName: 'html',
_childrenList: null,
_version: 12,
_nodeValue: null,
_parentNode: [Circular],
_memoizedQueries: {},
_readonly: false,
_tagName: 'html',
_namespaceURI: 'http://www.w3.org/1999/xhtml',
_created: true,
_localName: 'html',
_attached: true,
_attachedToDocument: true,
_style: [Object],
_ignoreValueOfStyleAttr: false },
_ids: { fieldName: [Object] },
_attached: true,
_referrer: 'http://localhost:3000/tours/hood-river',
_cookie: undefined,
_cookieDomain: '127.0.0.1',
_URL: '/',
_documentRoot: '/',
_queue: { paused: false, tail: [Object] },
readyState: 'complete',
_listeners: { load: [Object], DOMContentLoaded: [Object] },
_styleSheets:
{ '0': [Object],
'1': [Object],
'2': [Object],
'3': [Object],
'4': [Object],
'5': [Object],
'6': [Object],
_length: 7 },
_localStorage: { _area: [Object] },
_sessionStorage: { _area: [Object] },
_html5shiv: 1,
_nwmatcher:
{ ACCEPT_NODE: 'r[r.length]=c[k];if(f&&false===f(c[k]))break main;else continue main;',
byId: [Function],
match: [Function],
first: [Function],
select: [Function],
compile: [Function],
contains: [Function],
configure: [Function],
getAttribute: [Function],
hasAttribute: [Function],
setCache: [Function],
shortcuts: [Function],
loadResults: [Function],
saveResults: [Function],
emit: [Function],
Config: [Object],
Snapshot: [Object],
Operators: [Object],
Selectors: {},
Version: 'nwmatcher-1.3.8',
registerOperator: [Function],
registerSelector: [Function] } },
_childNodes: {},
_attributes:
{ '0':
{ _childNodes: [Object],
_ownerDocument: [Object],
_attributes: [Object],
_nodeName: 'type',
_childrenList: null,
_version: 1,
_nodeValue: '',
_parentNode: [Circular],
_memoizedQueries: {},
_readonly: false,
_name: 'type',
_specified: true,
_tagName: 'type',
_namespaceURI: null,
_localName: 'type',
_prefix: null,
_ownerElement: [Circular],
_created: true },
'1':
{ _childNodes: [Object],
_ownerDocument: [Object],
_attributes: [Object],
_nodeName: 'name',
_childrenList: null,
_version: 1,
_nodeValue: 'referrer',
_parentNode: [Circular],
_memoizedQueries: {},
_readonly: false,
_name: 'name',
_specified: true,
_tagName: 'name',
_namespaceURI: null,
_localName: 'name',
_prefix: null,
_ownerElement: [Circular],
_created: true },
_ownerDocument:
{ _childNodes: [Object],
_ownerDocument: [Circular],
_attributes: [Object],
_nodeName: '#document',
_childrenList: null,
_version: 341,
_nodeValue: null,
_parentNode: null,
_memoizedQueries: [Object],
_readonly: false,
_tagName: '#document',
_contentType: 'text/html',
_doctype: [Object],
_implementation: [Object],
_documentElement: [Object],
_ids: [Object],
_attached: true,
_referrer: 'http://localhost:3000/tours/hood-river',
_cookie: undefined,
_cookieDomain: '127.0.0.1',
_URL: '/',
_documentRoot: '/',
_queue: [Object],
readyState: 'complete',
_listeners: [Object],
_styleSheets: [Object],
_localStorage: [Object],
_sessionStorage: [Object],
_html5shiv: 1,
_nwmatcher: [Object] },
_parentNode: [Circular],
_readonly: false,
'_$ns_to_attrs': { null: [Object] },
'_$name_to_attrs': { type: [Object], name: [Object] },
length: 2,
type:
{ _childNodes: [Object],
_ownerDocument: [Object],
_attributes: [Object],
_nodeName: 'type',
_childrenList: null,
_version: 1,
_nodeValue: '',
_parentNode: [Circular],
_memoizedQueries: {},
_readonly: false,
_name: 'type',
_specified: true,
_tagName: 'type',
_namespaceURI: null,
_localName: 'type',
_prefix: null,
_ownerElement: [Circular],
_created: true },
name:
{ _childNodes: [Object],
_ownerDocument: [Object],
_attributes: [Object],
_nodeName: 'name',
_childrenList: null,
_version: 1,
_nodeValue: 'referrer',
_parentNode: [Circular],
_memoizedQueries: {},
_readonly: false,
_name: 'name',
_specified: true,
_tagName: 'name',
_namespaceURI: null,
_localName: 'name',
_prefix: null,
_ownerElement: [Circular],
_created: true } },
_nodeName: 'input',
_childrenList: null,
_version: 2,
_nodeValue: null,
_parentNode:
{ _ownerDocument:
{ _childNodes: [Object],
_ownerDocument: [Circular],
_attributes: [Object],
_nodeName: '#document',
_childrenList: null,
_version: 341,
_nodeValue: null,
_parentNode: null,
_memoizedQueries: [Object],
_readonly: false,
_tagName: '#document',
_contentType: 'text/html',
_doctype: [Object],
_implementation: [Object],
_documentElement: [Object],
_ids: [Object],
_attached: true,
_referrer: 'http://localhost:3000/tours/hood-river',
_cookie: undefined,
_cookieDomain: '127.0.0.1',
_URL: '/',
_documentRoot: '/',
_queue: [Object],
readyState: 'complete',
_listeners: [Object],
_styleSheets: [Object],
_localStorage: [Object],
_sessionStorage: [Object],
_html5shiv: 1,
_nwmatcher: [Object] },
_childNodes:
{ '0': [Object],
'1': [Circular],
'2': [Object],
'3': [Object],
'4': [Object],
'5': [Object],
'6': [Object],
'7': [Object],
'8': [Object],
'9': [Object],
'10': [Object],
'11': [Object],
'12': [Object],
'13': [Object],
'14': [Object],
'15': [Object],
'16': [Object] },
_attributes:
{ _ownerDocument: [Object],
_parentNode: [Circular],
_readonly: false,
'_$ns_to_attrs': {},
'_$name_to_attrs': {},
length: 0 },
_nodeName: 'form',
_childrenList: null,
_version: 17,
_nodeValue: null,
_parentNode:
{ _ownerDocument: [Object],
_childNodes: [Object],
_attributes: [Object],
_nodeName: 'div',
_childrenList: null,
_version: 16,
_nodeValue: null,
_parentNode: [Object],
_memoizedQueries: {},
_readonly: false,
_tagName: 'div',
_namespaceURI: 'http://www.w3.org/1999/xhtml',
_created: true,
_localName: 'div',
_attached: true,
_attachedToDocument: true },
_memoizedQueries: {},
_readonly: false,
_tagName: 'form',
_namespaceURI: 'http://www.w3.org/1999/xhtml',
_created: true,
_localName: 'form',
_attached: true,
_attachedToDocument: true },
_memoizedQueries: {},
_readonly: false,
_tagName: 'input',
_namespaceURI: 'http://www.w3.org/1999/xhtml',
_created: true,
_localName: 'input',
_attached: true,
_attachedToDocument: true }
객체 하나 던져주시는데 documentElement밑에 _refferrer에 해당 내용이 있다
그런데 이걸 어찌꺼내야 하는지...
zombie 버전이 다른탓인지 문법이 다르다 한참을 고생해도 뭔가 해결책이 안나온다.
197페이지는 그대로 따라하면 missing semicolon 이라는 경고가 나오면서 무한루프에 들어간다
;;;;
고난이다.
피드 구독하기:
댓글 (Atom)
-
운영체제를 다시 설치할때 보통 윈도우 인스톨러인가 UUI ? 뭐 정확히는몰라도 여러가지 프로그램을 사용하는데 이번에 rufus 라는 프로그램을 접하게 되었다. rufus 오류 미디어를 열 수 없습니다. 이런 오류를 뿜으면서 자꾸 안된다. ...
-
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) Posted on 22/04/2015 by Admin | Leave ...
-
타입스크립트 관련 이유없이 빨간줄이간다. 설정과 관련이 있는데 tsconfig.json이나 systemjs.config.js 에서 experimentalDecorators: true 설정을넣어줘도 안없어진다. 비쥬얼 스튜디오 코드 설...
댓글 없음:
댓글 쓰기