{"data":{"site":{"siteMetadata":{"title":"lastrites2018","author":"lastrites2018","siteUrl":"https://lastrites2018.netlify.com","comment":{"disqusShortName":"","utterances":"lastrites2018/gatsby-first-blog"},"sponsor":{"buyMeACoffeeId":""}}},"markdownRemark":{"id":"2a0a52e9-7993-5244-ae86-8f42803267bc","excerpt":"node의 mvc 패턴 이해하기 model 서버에서 하나의 자원을 정의할 때 그것을 모델이라고 한다. 모델은 데이터베이스의 테이블과 1:1 매칭 되어야 한다. 순서를 살펴보자. 사용자가 요청을 한다. Controller는 요청에 대한 정보를 Model에 요청을 한다. Model은 데이터베이스에서 정보를 가져온뒤 Controller에 전달한다. Controller는 정보에 대해 적당한 로직을 거친뒤 View에 전달한다. 전달받은 인자를 적절한 곳에 배치한 뒤 View…","html":"<h1 id=\"node의-mvc-패턴-이해하기\"><a href=\"#node%EC%9D%98-mvc-%ED%8C%A8%ED%84%B4-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0\" aria-label=\"node의 mvc 패턴 이해하기 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>node의 mvc 패턴 이해하기</h1>\n<h2 id=\"model\"><a href=\"#model\" aria-label=\"model permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>model</h2>\n<p>서버에서 하나의 자원을 정의할 때 그것을 모델이라고 한다. 모델은 데이터베이스의 테이블과 1:1 매칭 되어야 한다.</p>\n<p>순서를 살펴보자.</p>\n<ol>\n<li>\n<p>사용자가 요청을 한다.</p>\n</li>\n<li>\n<p>Controller는 요청에 대한 정보를 Model에 요청을 한다.</p>\n</li>\n<li>\n<p>Model은 데이터베이스에서 정보를 가져온뒤 Controller에 전달한다.</p>\n</li>\n<li>\n<p>Controller는 정보에 대해 적당한 로직을 거친뒤 View에 전달한다.</p>\n</li>\n<li>\n<p>전달받은 인자를 적절한 곳에 배치한 뒤 View는 사용자에게 전달해주며 끝난다.</p>\n</li>\n</ol>\n<p>출처:</p>\n<p><a href=\"http://posnopi13.tistory.com/12\">http://posnopi13.tistory.com/12</a></p>\n<h2 id=\"row-query---insert\"><a href=\"#row-query---insert\" aria-label=\"row query   insert permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>row query - insert</h2>\n<p>insert into messages (id,username,text,roomname,date) value (‘1’,‘test’,‘textm’,‘lobby’, now());</p>","frontmatter":{"title":"Immersive Sprint - database","date":"October 16, 2018"}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"slug":"/til/20181016 IM08D22 database/","previous":{"fields":{"slug":"/til/20181016 콜백과 모듈/"},"frontmatter":{"title":"콜백과 모듈","category":"TIL"}},"next":{"fields":{"slug":"/til/20181017 IM08D23 checkpoint 13/"},"frontmatter":{"title":"Immersive Sprint - checkpoint 13","category":"TIL"}}}}