# GET과 POST

* GET : 모든 정보를 보낼 때, url에는 모든 정보를 담고 있어야 한다.\
  &#x20;        하지만 로그인을 할 때 ID, PW를 입력하고 접속하면 url 상에 ID와 PW가 모두 노출되게 된다. \
  query string으로 데이터를 전송할 때 GET 방식의 장점.\
  (라우터를 통해 query string에 따라서 다른 결과를 보여줄 수 있다.)\
  express가 디폴트 값으로 데이터를 전송하는 방식.
* POST : 위와 같은 보안상의 이유로 POST방식이 사용될 수 있다.\
  &#x20;           대량의 데이터를 온전히 전송할 때 사용된다.\
  &#x20;           (url에 일정 규격이상의 정보가 담긴다면 서버는 그 이상의 정보는 버리기 때문이다.)\
  url상에서는 아무런 정보를 알 수 없지만, 사람의 육안으로 보이지 않게 불필요하게 정보가 노출되지 않는다는 특장점이 있다. 그리고 데이터 용량에 제한이 없다.\
  express에서 사용하려면 '**body-parser**' 라는 미들웨어가 필요하다.\
  익명함수 첫번째 인자 request객체에 'body'객체를 추가하고, 사용자의 데이터에 해당하는 프로퍼티를 생성하여 값을 넣어준다.

GET방식이든 POST방식이든 어떻게든 정보를 얻어낼 수는 있다. 둘 다 보안상으로 완전히 안전하지는 않다. 중간에 정보를 가져가는 것을 방지하기 위해 https 같은 것들이 존재한다.<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://heunnajo.gitbook.io/javascript/node.js/get-post.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
