Express.js

2021. 5. 30. 10:38node.js

Express를 왜 사용해야하는 가?

1. 웹서비스 관점

프레임워크 없이 웹서버를 띄운다-> http 내장 모듈, url 호출 등등 세션처리 방법이 귀찮다.

Express.js의 Middle Ware -> 개발 방법론을 제약할 수 있다.

"Middleware functions are functions that have access to the 
request object (req), the response object (res), and the next function
 in the application’s request-response cycle." -https://expressjs.com/en/guide/using-middleware.html

여기서 미들웨어 함수 req(요청) 객체, res(응답) 객체, 그리고 어플리케이션 요청-응답 사이클 도중 그 다음의 미들웨어 함수에 대한 엑세스 권한을 갖는 함수이다.

 

2. 프레임워크 선정

Sail.js, Hapi.js, Meteor.js 등등 많은 Node.js 프레임워크가 있다. 그 중에서도 Express.js를 사용해야하는 이유는 무엇일까

1. 사용층이 두텁다.

2. 많이 사용하고 있다 -> stackoverflow에 reference가 많다!

웹서버 띄우기 (Express를 곁들이지 않은)...

 사용자 -> Reqeust(URL 접속, form 전송)

 서버 -> Response(텍스트, 이미지)

사용자의 Request의 예: Naver 검색어 Query

 

'node.js' 카테고리의 다른 글

Node.js  (0) 2021.05.29