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

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

by 한선용, 이선 브라운
May 2021
Beginner to intermediate
448 pages
9h 47m
Korean
Hanbit Media, Inc.
Content preview from 한 권으로 끝내는 Node & Express(2판): 모던 웹을 위한 서버 사이드 자바스크립트의 모든 것
250
한 권으로 끝내는 Node & Express
있습니다. 하지만
app
에 실제로 추가하기 전에는 아무 일도 하지 않습니다. 라우트 인스턴스를
서브도메인에 연결하는
vhost
를 통해
app
에 추가합니다.
TIP
express
.
Router
로 라우트를 분할해 여러 라우트 핸들러를 한 번에 링크할 수도 있습니다. 자세한 정보는
익스프레스 라우팅 문서
2
를 보세요.
14.3
라우트 핸들러는 미들웨어입니다
3
주어진 경로에 대한 기본적인 라우팅은 이미 확인했습니다. 하지만
app
.
get
(‘/
foo
’,
...)
실제로
하는 일은 무엇일까요?
10
장에서 살펴본 것처럼 이는 단순히
next
메서드를 전달하는
특수한 미들웨어입니다. 조금 더 복잡한 예제를 봅시다 (
ch14
/
01
-
fifty
-
fifty
.
js
).
app.get(‘/fifty-fifty’, (req, res, next) => {
if(Math.random() < 0.5) return next()
res.send(‘sometimes this’)
})
app.get(‘/fifty-fifty’, (req,res) => {
res.send(‘and sometimes that’)
})
이 예제에서는 같은 라우트에 두 가지 핸들러를 사용했습니다. 일반적으로 첫 번째 핸들러가
실행되지만, 이 예제에서는 대략
50
%의 확률로 두 ...
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: 웹사이트 구축을 위한 서버 사이드 자바스크립트

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

한성용, 이선 브라운

Publisher Resources

ISBN: 9791162244227