Express (Node JS , Express, NodeMon)

0_CyberLover_0·2022년 3월 18일
0

Node.JS # 01

목록 보기
12/21
post-thumbnail

express에 대해서 알아 보자.

application에는 두가지 속성이 있다. (locals, mountpath)

method가 많이 있다. 그 중 하나가 get()이다.

express에 대해서 알고 가야 할것은 3가지이다.

하나는 request 이고 (request 속성 이 많이 있다.)

또하나는 response이다.

response에는 또 다른 method들이 있다.

res.cookie()라는 것도 있고

res.end()라는 것도 있다.

(바로 전 파트에서 써봤다. 접속 종료 시킨다.)

html을 보내는 기능도 있다.

const handleHome = (req, res) => {

return res.send("<h1>I still love you.😍</h1>");

};

express의 기본 틀은 이게 다이다.

router라는 거 까지 있다는것만 알고 있어도 된다.(routers는 routes를 정돈 하는 방법이다.)

JSON을 보내는 기능도 있다.


const handleLogin = (req, res) => {

return res.send({message: "Login here."});

};
profile
꿈꾸는 개발자

0개의 댓글