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: 웹사이트 구축을 위한 서버 사이드 자바스크립트
129
8
-
폼 처리
하나에 두 가지 서버 동작(
action
속성)이 들어 있다면 폼을 두 개 쓰십시오. 예를 들어 페이
지에 사이트 검색용 폼이 있고 이메일 뉴스 구독 신청용 폼이 따로 있을 수 있습니다. 모든 필
드를 폼 하나에 넣고 버튼에 따라 달리 동작하게 할 수 있기는 하지만 구현하기도 골치 아프고,
접근성을 중시하는 브라우저들이 폼을 렌더링하는 방식 때문에 장애가 있는 사람들은 이용하
기 어렵습니다.
8.3.
인코딩
브라우저나
AJAX
가 전송한 폼은 어떤 형식으로든 인코드되어야 합니다. 인코딩을 명시하지 않
았을 때 기본값은
application
/
x
-
www
-
form
-
urlencoded
입니다(‘
URL
인코드’를 길게 썼을 뿐입
니다). 이 인코딩은 기초적이고 쓰기 쉬우며 익스프레스에서도 기본으로 지원합니다.
파일 업로드하기는 좀 복잡합니다.
URL
인코딩으로 파일을 보내는 쉬운 방법은 없으므로
multipart
/
form
-
data
인코딩 타입을 써야 합니다. 익스프레스 최근 버전은 기본적으로 이 인
코딩을 지원하지 않으므로, 이 인코딩을 대체할 방법에 대해 곧 설명하겠습니다.
8.4.
폼을 처리하는 다른 방법
AJAX
를 쓰지 않으면 폼을 전송할 때 페이지를 다시 불러오는 브라우저의 기본 방식을 따를 수
밖에 없습니다. 하지만 페이지를 다시 불러오는 방법은 바꿀 수 있습니다. 폼을 처리할 때 고려
할 것은 두 가지입니다. 첫 번째는 처리할 서버 경로(
action
)이고 두 번째는 브라우저에 보낼
응답입니다.
폼에서
method
=
'
POST
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