Skip to Content
한 권으로 끝내는 Node & Express: 웹사이트 구축을 위한 서버 사이드 자바스크립트
book

한 권으로 끝내는 Node & Express: 웹사이트 구축을 위한 서버 사이드 자바스크립트

by 한성용, 이선 브라운
April 2016
Beginner to intermediate
389 pages
9h 8m
Korean
Hanbit Media, Inc.
Content preview from 한 권으로 끝내는 Node & Express: 웹사이트 구축을 위한 서버 사이드 자바스크립트
274
한 권으로 끝내는 Node & Express
});
});
},
};
이 컨트롤러는 라우트 관리를 실제 기능에서 분리했습니다. 여기서
home
,
preferences
,
orders
메서드는 뷰 선택을 빼면 완전히 같습니다. 할 일이 이것뿐이라면 이들을 결합해 범용
메서드를 만들었겠지만, 이렇게 한 주 목적은 각 메서드를 더 수정할 수 있게 하는 겁니다.
이 컨트롤러에서 가장 복잡한 메서드는
ajaxUpdate
입니다. 이름만 봐도
AJAX
를 써서 프론트
엔드에서 업데이트할 거라는 게 분명하군요. 하지만 요청 본문에서 전달된 매개변수를 맹목적
으로 믿고 고객 객체를 업데이트하지는 않았습니다. 그렇게 하면 공격자에게 문을 열어주게 됩
니다. 필드를 각각 처리하면 할 일이 좀 더 많지만, 그만큼 더 안전합니다. 프론트엔드에서도
당연히 유효성 검사를 했겠지만, 여기서도 합니다. 공격자가 자바스크립트를 살펴보고 프론트
엔드 유효성 검사를 건너뛰는
AJAX
쿼리를 만들어 애플리케이션 공격을 시도할 수 있다는 걸
잊지 마십시오. 중복이더라도, 항상 서버에서 유효성 검사를 해야 합니다.
거듭 말하지만, 제한은 상상력뿐입니다. 컨트롤러를 라우팅에서 완벽히 분리하고 싶다면, 당연
히 그렇게 할 수 있습니다. 필자의 의견으로는 불필요한 추상화지만, 네이티브 앱처럼 다른 종
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

한 권으로 끝내는 Node & Express(2판): 모던 웹을 위한 서버 사이드 자바스크립트의 모든 것

한 권으로 끝내는 Node & Express(2판): 모던 웹을 위한 서버 사이드 자바스크립트의 모든 것

한선용, 이선 브라운

Publisher Resources

ISBN: 9788968482229