앞에 올린 글
노드js express로 로그인 창만들때
헷갈렸던 거
app.get app.post 차이

get은 /주소 보이는 방식이라서 /뒤에 주소 써주는데로 이동하고 띄우고 get써서 경로이동할 수 있게 하고
post는 주소 안보여주는 방식. 눈에 보이지 않는 주소요청 받아처리함. post에서는 서버에서 처리할 일 요청할 수도 있고 데이터를 전송할 수도 있음
앞에 쓴 글
코드 보면
html에서
post 로 form 써서
메인페이지랑
로그인페이지 둘다 name 데이터 전송해서 썼어
app.js 에서는 경로 이동 쉽게 할려고 get쓰고
post로 정보 받아서 썼구나
오호...
res.send 특징
res.write 써야돼? 여러개 쓰고 싶으면?
https://fierycoding.tistory.com/18

- res.send(body), res.send(status, body) : 클라이언트에 응답을 보냄. 상태 코드는 옵션. 기본 콘텐츠 타입은 text/html이므로 text/plain을 보내려면 res.set(‘Content-Type’, ‘text/plain’)을 먼저 호출 해야한다. JSON을 보낼거면 res.json을 쓰자.
사실 정말 가려운 곳 못긁었는데 차차 해보면서 알아가도록 ..
키 값
name vaule 차이가 뭐야
넘길 때 왜 name 넘겨주면 value는 왜 쓰지..
Value = The value attribute specifies the value of an element.
Name = name is only to post form data. The name definies what the name of the attribute will be as soon as the form is submitted. So if you want to read this attribute later you will find it under the "name" in the POST or GET Request. Whereas the id is used to adress a field or element in javascript or css.
아하!!
맞다

요거네 name이 전달되고 value는 입력 태그의 초기값
HTML - input태그와 그 속성 type, value, name - 입력태그 (1)
HTML - input태그와 그 속성 type, value, name 입력태그 (1) 오늘은 input태그와 그 속성 type, value, name에 대해서 알아 보도록 하겠습니다. 태그 기초부터 알아보기 전에 압타나 스튜디오를 직접 설치 하.
yangbari.tistory.com
오호라 헷갈렸어
'노드 node.js' 카테고리의 다른 글
몽고디비 MongoDB (0) | 2021.09.26 |
---|---|
MYSQL 실행하기 (cmd조작) / 테이블 만들기 데이터 입력, 삭제,정렬 (0) | 2021.09.22 |
node.js 로그인 창 만들기(npm,express,cookie)/ 에러 해결 app crashed - waiting for file changes before starting... (0) | 2021.09.16 |
express 배우기 책 따라하는 중 p229-250 (0) | 2021.09.16 |
템플릿 엔진 Template Engine (0) | 2021.09.14 |