<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>구르소 기술 블로그</title>
    <description>If really love what you do, then the rest follows
</description>
    <link>https://tech.devmaker.kr/</link>
    <atom:link href="https://tech.devmaker.kr/rss" rel="self" type="application/rss+xml"/>
    <pubDate>Fri, 27 Nov 2026 13:12:34 +0900</pubDate>
    <lastBuildDate>Fri, 27 Nov 2026 13:12:34 +0900</lastBuildDate>
    <generator>Jekyll v4.4.1</generator>
    
      <item>
        <title>프리랜서 5년 회고</title>
        <description>&lt;p&gt;1년 3개월, 3년 10개월 동안 프리랜서를 해왔다. 총 5년 1개월이 흘러갔다. 처음에는 외주가 많아 시작이 좋았다. 코로나 특수였기 때문이다. 이제는 과외를 하고 외주를 해서 먹고 살고있다. 오늘은 5년 1개월 간의 여정에 대한 회고를 할거다.&lt;/p&gt;

&lt;h2 id=&quot;1-동굴-안에서-나오지-않던-나&quot;&gt;1. 동굴 안에서 나오지 않던 나&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/reflected-on-5-years-ago/01.png&quot; alt=&quot;01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;del&gt;화장실에서 찍은 사진이라 불편하면 미안하다. 사진이 없었다.&lt;/del&gt; 병원에서 퇴원하면서 나는 한 동안 집에서 나오질 않았다. 사회에서의 내 자리가 없다고 생각했기 때문이다. 그래도 온라인에는 내 소개를 올려놨고 책을 쓰게 되었다. 그게 내 2번 째 사회생활의 시작을 의미했다.&lt;/p&gt;

&lt;h2 id=&quot;2-코로나-특수&quot;&gt;2. 코로나 특수&lt;/h2&gt;

&lt;p&gt;중국에서 코로나가 발병했다. 전염성이 있고 죽을 수 있다고 언론은 떠들었다. 그런데 웬일 오프라인이 망하고 온라인이 살아나기 시작했다. 크몽으로 의뢰가 쏟아져 들어왔다. 사람들이 집밖으로 못나가니 오프라인에서 온라인으로 돈이 흐르기 시작했던거다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;인스마스터(사내 보험 관리자 사이트) 개발&lt;/li&gt;
  &lt;li&gt;MRT(거래소 사이트) 개발&lt;/li&gt;
  &lt;li&gt;리스팅(이커머스 관리자 사이트) 개발&lt;/li&gt;
  &lt;li&gt;커스랜드(부동산 매물 찾기 사이트) 개발&lt;/li&gt;
  &lt;li&gt;제이엠파워(마스크 판매 및 관리자 사이트) 개발&lt;/li&gt;
  &lt;li&gt;가루다(공부 SNS 앱 서버) 개발&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;이때 나는 월에 천만원 정도 3번 반복해 벌었다. 그동안 월급을 모아둔 것도 있었지만 외주가 자산형성에 매우 큰 역할을 해줬다. 기분 좋은 시작이였다.&lt;/p&gt;

&lt;h2 id=&quot;3-욕심을-부렸다&quot;&gt;3. 욕심을 부렸다&lt;/h2&gt;

&lt;p&gt;득이양양해진 나는 초기 스타트업 공고를 유심히 지켜보고 있었다. 취업하고 싶은 욕망은 꺼지질 않았던 것이였다. 웬일 프로그라운드라는 회사에서 나에게 연락을 해왔다. 먼저 연락을 주신게 너무 감동 받아서 면접을 보고 입사를 하게 되었다.&lt;/p&gt;

&lt;p&gt;모난 사람 없이 회사는 목표를 향해 달려갔다. 인턴이 선린 후배라 많이 반가웠다. 꼰대가 된 나는 동아리와 과를 물어보고 열심히 꼰대짓을 했다. 그래도 서버를 좀 가르쳐줬다. 나는 테크리더를 목표로 동료들과 로켓을 만들기 시작했다. 하지만 한계가 있었고 우리는 위기에 직면했다. 그러다 투자자측에서 블록체인을 연동해 달리기 리워드 앱을 만들자고 제안을 주셨고 우리는 또 다시 달렸고 다른 업체들과 경쟁을 하고 1등을 사수했다. 이때 나는 많은 기여를 했다고 생각해 스스로 자랑스러웠다. 하지만 1년을 못가 아프기 시작했고 팀장과 마찰이 생겼다. 엎친데 덮친격이라 그만뒀다.&lt;/p&gt;

&lt;p&gt;지금 생각해보면 이때가 나의 최전성기였던것 같다. 이 시간은 첫 프리랜서를 하고 잠깐의 1년을 보냈다고 생각한다.&lt;/p&gt;

&lt;h2 id=&quot;4-창업-찍먹&quot;&gt;4. 창업 찍먹&lt;/h2&gt;

&lt;p&gt;23년도 1월말 퇴사 후 원룸 계약이 끝나지 않아 관악구에 한 동안 있었다. 그러다 창업 부트캠프 창을 발견하고 스타트업 경험을 살려 창업 찍먹을 해보기로 했다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/reflected-on-5-years-ago/02.png&quot; alt=&quot;02&quot; /&gt;&lt;/p&gt;

&lt;p&gt;1차 미션에서는 10만원으로 얼만큼 불릴 수 있는지가 미션이였다. 나는 막내 포지션이였고 네트워킹 파티를 주최해 성공적으로 미션을 수행했다. 이 때 팀원 분들이 다들 뛰어나신 분들이라 진행과 준비를 잘해주셨다.&lt;/p&gt;

&lt;p&gt;2차에서는 실제 팀을 만드는 미션이였다. 얼떨결에 팀장이 되었고 나 포함 3명과 전직장 동료 한분이 서포트를 해주셨다. 그러다 고민톡톡이라는 앱을 개발하고 아이디어를 PPT화 해서 VC 앞에서 팀장을 맡아 발표를 했었다. 당일 날 발표 연습은 잘했냐고 물어보셔서 그렇다고 했다. 발표는 잘끝냈다.&lt;/p&gt;

&lt;p&gt;페르소나를 정의하는 법과 문제 해결을 하는 과정에서 많이 배웠다. 하지만 이 때도 몸이 자주 아파 속상했다. 이 시간을 따로 정리해서 링크드인에 올렸는데 참 의미 있는 시간이였다. 한 팀원 분은 결혼하셔서 최근에 식장을 갔다오기도 했다. 잘사셨으면 한다.&lt;/p&gt;

&lt;h2 id=&quot;5-인생-그래프가-이상하다&quot;&gt;5. 인생 그래프가 이상하다&lt;/h2&gt;

&lt;p&gt;잘풀릴 때도 있었고 나락을 가기도 했었고 멘탈이 쿠쿠다스가 되어 갔다. 엄마랑 정말 많은 이야기를 했고 내가 너무 아파하자 구로에 오피스텔 매매를 알아봐주셨다. 관악구는 머니깐 집 근처에서 살면서 챙겨준다고 하셨다. 나락에 빠져 허우적 되던 나에게는 기회라 생각했고 국민은행에서 대출을 받아 현금을 합쳐 매매를 했다. 지금의 내가 있을 수 있게 보금자리가 되어 줬다.&lt;/p&gt;

&lt;h2 id=&quot;6-과외&quot;&gt;6. 과외&lt;/h2&gt;

&lt;p&gt;과외는 회사를 나오자마자 꾸준히 홍보했던 일이였는데 숨고를 알게 되었고 포텐이 터져 6명 정도 과외를 가르칠 수 있었다. 숨고 포함 총 15명정도 가르친것 같다. 파이썬, 자바스크립트, C언어를 가르쳤고 이는 내가 학점은행제로 학사에 도전하고 정보처리기사를 준비하게 되었으며 NCS 강사에 도전할 수 있는 생각의 시발점이 되었다.&lt;/p&gt;

&lt;p&gt;이제 소개는 이렇게 하고 있다.&lt;/p&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;👋 파이썬 개발자&lt;/td&gt;
      &lt;td&gt;저자&lt;/td&gt;
      &lt;td&gt;강사&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;● 파이썬으로 글로벌 서비스 백엔드 개발 · 250만 유저 관리&lt;/p&gt;

&lt;p&gt;● 타입스크립트로 블록체인 전문성(KAIA, TON) 보유&lt;/p&gt;

&lt;p&gt;● 프리랜서로 다수 프로젝트 진행, 크몽 18건 평점 5.0&lt;/p&gt;

&lt;p&gt;● 한빛미디어 『핸즈온 FastAPI』, 『처음 배우는 플라스크 웹 프로그래밍』 저자&lt;/p&gt;

&lt;p&gt;● 인프런 「FastAPI 더 잘써먹기」, 「파이썬 자료구조와 알고리즘으로 만드는 미니 게임」 강의&lt;/p&gt;

&lt;p&gt;● 고려대 데이터 청년 캠퍼스 특강 · 전남대 블록체인 멘토&lt;/p&gt;

&lt;p&gt;● 프로그래밍 과외 15명 이상, 숨고 6건 평점 5.0&lt;/p&gt;

&lt;h2 id=&quot;7-결론&quot;&gt;7. 결론&lt;/h2&gt;

&lt;p&gt;세상은 나를 책임져 주지 않는다 오히려 눈뜨고 코베이는 세상이다. 직장 3년 프리랜서 5년 경력의 나는 그 동안의 경험과 능력으로 NCS 강사라는 또 다른 도전을 하게 되었다. 세상이 나를 억까하면 열심히 울고 다시 툭툭 일어나서 자기 페이스로 나아가면 된다. 그게 나의 전부였던 것 같다. 나는 오늘도 프리랜서를 하고 있다.&lt;/p&gt;
</description>
        <pubDate>Wed, 25 Nov 2026 19:00:00 +0900</pubDate>
        <link>https://tech.devmaker.kr/2026/11/25/reflected-on-5-years-ago</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2026/11/25/reflected-on-5-years-ago</guid>
        
        <category>프리랜서</category>
        
        <category>강사</category>
        
        <category>개발자</category>
        
        <category>저자</category>
        
        
        <category>freelancer</category>
        
      </item>
    
      <item>
        <title>처음 배우는 플라스크 웹 프로그래밍 책 집필 회고</title>
        <description>&lt;p&gt;책을 집필하게 되었다. 집필에 반년이 걸렸고 출판까지 8개월의 시간이 걸렸다. 
첫 회사에서 처음 접하게 되었던 Flask, 어떻게 보면 지겨울 정도로 Flask와 인연이 깊은 나는 책까지 쓰게 되다니 참 신기한 일이다. FastAPI로 마이그레이션을 하는 와중 끝물에 책을 쓰게된 나는 여러가지 상황에 처하게 되는데 그 이야기를 해보려고 한다.&lt;/p&gt;

&lt;h2 id=&quot;1-카우치-코딩으로-맺어진-인연&quot;&gt;1. 카우치 코딩으로 맺어진 인연&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/first-flask/01.png&quot; alt=&quot;first-flask-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;기억을 더듬어 생각을 해보면 과외 사업을 한창 진행하던 중 인프런 같은 플랫폼이 내 시야에 들어오게 되었고
하고 싶다는 생각까지 하던 중 카우치 코딩에서 개발자를 대상으로 영업을 하고 있었고 그 망에 나도 포함되어 있었다. 나는 당연히 YES를 
외쳤고 수업 목차를 작성해 제출하였다.&lt;/p&gt;

&lt;p&gt;그런데 학생 대신 한빛미디어 IT팀에서 연락이 왔다. 책 집필할 생각이 없는지, 그렇게 나는 카우치 코딩으로 맺어진 인연으로 책을 쓰게 되었다.&lt;/p&gt;

&lt;h2 id=&quot;2-책-집필-과정&quot;&gt;2. 책 집필 과정&lt;/h2&gt;

&lt;p&gt;Flask로 끝장을 본적이 있는 나는 목차를 완성하는데 그렇게 큰 수고가 들지 않았다. 단지 머릿속에 있는 것을 끄집어 내는 과정이였을 뿐.. 
책을 이렇게 빨리 쓴 케이스도 흔하지 않다고 편집자님께서 말씀해주셨다. 나랑 동시에 책을 쓰게된 분이 있는데 그 분은 아직도 책을 쓰고 있다고 하신다. 실제로 그렇게 걸리는게 사실이라고 말씀을 해주셨다.&lt;/p&gt;

&lt;p&gt;다만 되돌아 보면 목차 완성에 노력을 더 기울였어야 했는데 내가 제출한 목차는 지적을 받게 되었고 프로젝트 중심으로 글을 쓰자고 제안을 해주셔서 그렇게 쓰게 되었다. 
다행히 책을 쓰기 위한 프로세스는 한빛미디어라는 큰 회사 답게 배울점도 많았고 집필하는데 큰 도움이 되었다. 
그래서 완성된 목차는 기초, 테스트, 비동기, 프로젝트, 배포 정도로 보면 되었다. Flask 만으로는 장고를 이길 수 없다고 판단해 차별점을 두기 위해 공을 많이 들었다. 
그 예로 RxPY, Celery, Git Action 등을 책 장점으로 내세웠다.&lt;/p&gt;

&lt;p&gt;그리고 어떻게 하면 오타가 없게 작성할 수 있을까? 내용이 잘못된 내용이면 어떻게 하지? 라는 생각을 하게 되었고 마침 과외를 하고 있던 나는 과외받는 분을 적극 활용해 수업으로 책 내용을 진행해봤다. 
역시나 실습이 최고라고 많은 오타와 내용 수정을 거칠 수 있었고 편집자님의 통과를 얻어 내었다. 
물론 베타리딩 때 수 많은 지적을 받았지만 그나마 이정도로 해서 다행이였다고 생각이 들었다.&lt;/p&gt;

&lt;p&gt;머릿속에 있던 내용을 꺼내는 작업이라고 표현을 했는데 실제로 나는 Flask를 활용해 250만 유저를 경험해봤고 40대의 글로벌 서버를 관리해봤다. 
또 업무량도 상당해 수 많은 비즈니스 로직과 알고리즘들을 구현한 경험이 있었다. 정말 힘들었지만 그 과정이 있기에 지금의 내가 있다고 더구나 책까지 쓸수 있었다고 생각한다.&lt;/p&gt;

&lt;h2 id=&quot;3-책-판매-시작&quot;&gt;3. 책 판매 시작&lt;/h2&gt;

&lt;p&gt;2021년 08월 30일 책이 출판되었다. 일단 온라인에서 반응을 보고 괜찮으면 오프라인 서점에서도 팔것이라고 귀뜸을 해주셨다. 
고난과 역경을 겪어 온 나에게 더 이상 가슴이 뛰지 않을 것 같았는데 온라인에 내 이름이 떡하니 있는 것을 보고 조금은 설렜다. 정말 조금만 설렜다.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;파이썬 개발 튜터 및 컨설팅 업무를 하고 있다. 선린인터넷고등학교를 졸업 후 서버 개발자로 활동 중이다. 250만 유저가 사용하는 서비스와 40대 글로벌 서버 개발 경험이 있고 아웃소싱 및 정부 R&amp;amp;D 과제에 참여했다.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;엄마께서는 그 옛날 4년제 대학을 나오셨고 독서를 엄청하시는 분이다. 아들이 책을 쓴다는 말을 듣고 정말 좋아해주셨다. 엄마 덕일지도 모른다는 생각이 들었다. 책에는 항상 진심이었던 분이였으니깐.&lt;/p&gt;

&lt;h2 id=&quot;4-책-판매-중&quot;&gt;4. 책 판매 중&lt;/h2&gt;

&lt;p&gt;독자에서 저자가 되었다. 일상은 크게 달라지지 않았지만 이력서에 쓸 내용 한줄이 추가 되었다. 
엄청 어렵고 훌륭한 책을 쓴것은 아니지만 열심히 살면 그 보상은 언젠가는 온다는 것을 체감할 수 있었고 실제로 이루어졌다. 최근 현타가 많이 와 지쳤지만 다시 할수 있는 원동력이 되었다고 할까? 
오프라인 매장에서도 내 책을 볼수 있는 그날까지 하루하루 최선을 다하면서 살아볼 것이다. 예전에도 그래왔고 지금도 그럴 것이다.&lt;/p&gt;

&lt;p&gt;잠깐 다른 이야기를 하자면 나는 정말 큰 일들을 연속으로 겪어 마음에 병이 생겼고 몇년째 병원을 다니고 있었다. 그래서 극복하기 위해서 다른 사람들은 어떻게 살까? 라는 궁금점이 생기게 되었고 
나만 힘든가? 라는 생각과 함께 많은 사람들을 만나보았다. 첫 번째 회사 CTO님, 세 번째 회사 CTO님, 직장동료, 친구 등등 정말 많이 만나 봤고 그 사람들의 생각을 들어 보았다. 
물론 내가 하는 이야기가 무조건 맞다는 것도 아니고 그 사람들의 이야기가 무조건 옳다는 것도 아니다. 다만 희망을 생기게 해주기에는 충분한 말들을 해주셨다. 
친구들은 너가 좋은 사람이니깐 주변에 좋은 사람이 많은거라고 해줬고 CTO님들은 자신의 이야기를 해주셨다. 
나는 참 운이 없는 아이인데 유일하게 사람 복은 많이 가지고 태어난 것 같다.&lt;/p&gt;

&lt;p&gt;결론은 행복은 정말 노력을 많이 해야지 찾아오지만 불행은 그렇지 않다는 것이였다. 그렇다고 절망은 하되 희망까지 잃지는 말자는게 나의 생각이다. 
노력의 보상은 꼭 찾아올 것이고 무언가가 나를 행복하게 해줄것이다. 
노력과 집착을 통해서 성취하고 행복하게 살자. 이상이다.&lt;/p&gt;

&lt;h2 id=&quot;5-마무리&quot;&gt;5. 마무리&lt;/h2&gt;

&lt;p&gt;위에서 마무리를 지었지만 책에 대한 마무리를 짓자면 천 부 정도를 찍었다고 말씀을 해주셨다. 그리고 그 인쇄비 중 일부를 내가 가지게 되었다. 베스트 셀러가 아니라 큰 돈까지는 아니지만 소중하게 느낄정도의 금액이라고 나는 생각한다.&lt;/p&gt;

&lt;p&gt;인생은 어떻게 보면 값진 경험을 하기 위해서 태어난게 아닐까 싶다. 그게 결혼이든 연애이든 커리어든 사람은 행복하자고 존재한다고 나는 믿는다.&lt;/p&gt;

&lt;p&gt;프리랜서로 자리를 잡게 되었고 앞으로의 미래를 그릴 수 있는 이유가 생겼다. 행복해지자. 행복해하자.&lt;/p&gt;

&lt;p&gt;진짜 끝!&lt;/p&gt;
</description>
        <pubDate>Sun, 17 Oct 2021 03:00:49 +0900</pubDate>
        <link>https://tech.devmaker.kr/2021/10/17/first-flask</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2021/10/17/first-flask</guid>
        
        <category>python</category>
        
        <category>flask</category>
        
        
        <category>programming</category>
        
      </item>
    
      <item>
        <title>인사이드 자바스크립트 part 1</title>
        <description>&lt;p&gt;요즘 자바스크립트에 푹 빠져있다. 취업을 위해서는 엔터프라이즈 언어를 배우는게 더 도움이 될꺼라는 조언을 받았지만 가슴이 시키는 것을 하고 싶었다. 책 리뷰는 잘하지 않지만 지금까지 산 전공책만 해도 40권이 넘은데 안하면 웬지 손해보는 느낌이였다. 그래서 오늘은 공부 동기부여도 될겸 인사이드 자바스크립트 책을 소개하려고 한다.&lt;/p&gt;

&lt;h2 id=&quot;1-책-선택&quot;&gt;1. 책 선택&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/inside-javascript-part-1/01.jpg&quot; alt=&quot;inside-javascript-part-1-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;나는 어쨌든 학교에서 배운 언어들과 실무에서 배운 파이썬을 알고 있기 때문에 초급자 입장에서 바라볼 필요는 없었다. 찾아본 책으로는 “모던 자바스크립트 딥 다이브”, “혼자 공부하는 자바스크립트”, “코어 자바스크립트”, “인사이드 자바스크립트”가 있었다. 프론트엔드를 하기 위해서 자바스크립트를 배우는 것이 아니기 때문에 입문서는 그렇게 필요하지 않았다. 오히려 react나 node.js를 찾아보는게 더 도움 됐을지 모른다. 하지만 나는 본질을 이해해야지 그 상위 개념들도 쉽게 이해할 수 있다고 믿고 있다. 결국 초중급을 지향하는 인사이드 자바스크립트 책과 좀 더 딥하게 배울 수 있는 코어 자바스크립트 책을 골랐다. 오늘 소개할 책은 인사이드 자바스크립트이다. 그럼 내가 배운 것들을 같이 짚어보자.&lt;/p&gt;

&lt;h2 id=&quot;2-책-요약&quot;&gt;2. 책 요약&lt;/h2&gt;

&lt;h3 id=&quot;자바스크립트-데이터-타입&quot;&gt;자바스크립트 데이터 타입&lt;/h3&gt;

&lt;p&gt;자바스크립트 기본 타입으로는 숫자, 문자열, 불린값, null, undefined 등이 있다. 또한 자바스크립트는 느슨한 타입 체크 언어로 변수에 어떤 타입이 들어가도 상관하지 않는다.
숫자의 경우 정수형이 따로 없고, 모든 숫자를 실수로 처리하므로 5/2를 했을 때 2.5가 나오게 된다.
문자열 같은 경우에는 작은 따옴표나 큰 따옴표로 생성한다. 주의할 점으로는 한 번 정의된 문자열은 변하지 않는다.
null과 undefined 타입 모두 ‘값이 비어 있음’을 나타낸다. undefined는 타입이자 값을 나타낸다. null같은 경우에는 타입은 object이고 값을 비교할 때에는 일치 연산자(===)를 사용해서 값을 확인해야 한다.&lt;/p&gt;

&lt;p&gt;NaN(Not a Number) 값은 수치 연산을 해서 정상적인 값을 얻지 못할 때 출력되는 값이다.
1 – ‘hello’ 연산 결과는 NaN이다.&lt;/p&gt;

&lt;p&gt;자바스크립트에서는 5가지의 기본타입을 제외한 모든 값은 객체다. 배열, 함수 등이 객체로 취급된다. 참조타입이라고 부르는데 모든 연산이 실제 값이 아닌 참조 값으로 처리되기 때문이다.
기본 타입의 경우에는 값에 의한 호출 방식이고 참조 타입의 경우 참조에 의한 호출 방식으로 작동한다.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;objA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;changeValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;num&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;num&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;changeValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;objA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;objA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;cm&quot;&gt;/*
200
{ value: 200 }
100
{ value: 200 }
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;기본 타입인 경우에는 값이 복사되지만 참조 타입인 경우에는 값이 변하는 것을 확인할 수 있다.&lt;/p&gt;

&lt;p&gt;자바스크립트의 모든 객체는 자신의 부모 역할을 하는 객체와 연결되어 있다. 부모 객체의 프로퍼티를 쓸 수 있다. 이러한 부모 객체를 프로토타입 객체라고 부른다.&lt;/p&gt;

&lt;h3 id=&quot;연산자&quot;&gt;연산자&lt;/h3&gt;
&lt;p&gt;연산자(+)는 더하기 연산과 문자열 연결 연산을 수행한다. 모두 숫자일 경우에만 더하기 연산이 수행되고, 나머지 문자열 연결 연산이 이뤄진다.&lt;/p&gt;

&lt;p&gt;==(동등) 연산자와 ===(일치) 연산자가 있다. == 연산자는 타입이 다른 경우 타입 변환을 거쳐 비교하지만 === 연산자는 타입이 다를 경우 변환하지 않고 비교한다.&lt;/p&gt;

&lt;p&gt;!! 피연산자를 불린값으로 변환하는 것이다.&lt;/p&gt;

&lt;h3 id=&quot;함수-호이스팅&quot;&gt;함수 호이스팅&lt;/h3&gt;
&lt;p&gt;함수 선언문 형태로 정의한 함수의 유효 범위는 코드의 맨 처음부터 시작한다. 이것을 함수 호이스팅이라고 한다.&lt;/p&gt;

&lt;h3 id=&quot;함수-객체&quot;&gt;함수 객체&lt;/h3&gt;
&lt;p&gt;자바스크립트에서는 함수도 객체다. 자바스크립트 함수는 다음과 같은 동작이 가능하다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;리터럴에 의해 생성&lt;/li&gt;
  &lt;li&gt;변수나 배열의 요소, 객체의 프로퍼티 등에 할당 가능&lt;/li&gt;
  &lt;li&gt;함수의 인자로 전달 가능&lt;/li&gt;
  &lt;li&gt;함수의 리턴값으로 리턴 가능&lt;/li&gt;
  &lt;li&gt;동적으로 프로퍼티를 생성 및 할당 가능
이와 같은 특징이 있으므로 자바스크립트에서는 함수를 일급객체라고 부른다.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;콜백-함수&quot;&gt;콜백 함수&lt;/h3&gt;
&lt;p&gt;함수의 이름을 지정하지 않아도 함수가 정의되며 이러한 함수가 익명 함수라고 한다. 대표적인 용도로는 콜백 함수이다.&lt;/p&gt;

&lt;h2 id=&quot;마치며&quot;&gt;마치며&lt;/h2&gt;
&lt;p&gt;가볍게 책 내용을 소개해봤다. 뒷장으로 가면 갈수록 어려워 질 것이다. 가슴이 식어도 꾸준히 배워서 정복하자. 이상 인사이드 자바스크립트 요약이였다.&lt;/p&gt;
</description>
        <pubDate>Tue, 01 Jun 2021 20:00:49 +0900</pubDate>
        <link>https://tech.devmaker.kr/2021/06/01/inside-javascript-part-1</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2021/06/01/inside-javascript-part-1</guid>
        
        <category>js</category>
        
        <category>javascript</category>
        
        
        <category>programming</category>
        
      </item>
    
      <item>
        <title>프리랜서로 살아남기 part 1</title>
        <description>&lt;p&gt;1년간 어떻게 프리랜서 개발자로 자리를 잡을 수 있었는지 그 경험담을 공유한다.&lt;/p&gt;

&lt;h2 id=&quot;1-시장조사&quot;&gt;1. 시장조사&lt;/h2&gt;

&lt;p&gt;나는 몇 개월간 프리모아, 위시캣, 크몽에 있는 프로젝트들을 조사했다. 
프리모아와 위시캣은 대형 프로젝트 중심, 크몽은 소규모 프로젝트 중심으로 돌아가고 있었다.
여기서 크몽의 성장 가능성을 확인 할수 있었다. 크몽은 방문자가 많은 것에 비해 큰 규모의 프로젝트를 찾아보기 힘들었다. 
물론 크몽 맞춤견적을 보면 대형 프로젝트들도 있지만 수주 확률은 글쎄?라는 생각을 들게 했다.&lt;/p&gt;

&lt;p&gt;그럼 내가 잘해왔던 관리자 페이지 개발 서비스를 크몽에 출시하면 어떨까?
방문자도 많고 분명 관리자 페이지에 대한 니즈가 있는 상황이였지만 아무도 올라와 있지 않았기 때문이다.
관리자 페이지라고 하면 대형 SI 업체를 거쳐야 될 듯 싶지만 꼭 그렇지만은 않다.
내가 첫 외주를 할 때도 관리자 페이지를 만드는 것이였는데 도매 관련 도메인이었다. 이때부터 나는 소규모 회사들의 시스템 전산화에 대한 니즈를 확인할 수 있었다.&lt;/p&gt;

&lt;p&gt;결국 확신을 가지게 되었고 크몽에 둥지를 틀게 되었다.&lt;/p&gt;

&lt;h2 id=&quot;2-가격설정&quot;&gt;2. 가격설정&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how-to-survive-as-a-freelancer-part-1/01.png&quot; alt=&quot;freelancer-part-1-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;사실 가격 설정은 실패한 부분이 조금 있다. 싸다고 생각해서 온 사용자들이 문의를 하면 결국 가격 때문에 돌아가는 경우가 있었기 때문이다.
조만간 가격은 수정할 생각이다. 하지만 동시에 3건까지 맡을 정도록 니즈는 확실했다는 것을 말해주고 싶다.&lt;/p&gt;

&lt;p&gt;10만원대는 간단한 폼으로 설문조사 정도의 프로젝트를 생각하고 가격측정을 했다.
150만원은 5p이내의 게시판, 캘린더, 엑셀 컨트롤, SNS 로그인 제공 정도로 생각하고 만들었다.
250만원은 프레임워크 선택 옵션을 추가했다.&lt;/p&gt;

&lt;p&gt;여기서 경쟁력은 언어와 상관없이 사용할수 있도록 만든 모듈들이 한몫했다고 생각한다. 
테이블을 읽어와서 코드 몇줄이면 자동화 테이블을 만들어주는 모듈, 각종 SNS 로그인 인증 모듈, 페이지 별 권한 설정 가능한 모듈들 모두 외주를 수주할 때 한몫했던 모듈들이다.
덕분에 경쟁력 있는 가격으로 공급을 할수 있게 되었던 것 같다.&lt;/p&gt;

&lt;h2 id=&quot;3-실적&quot;&gt;3. 실적&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how-to-survive-as-a-freelancer-part-1/03.png&quot; alt=&quot;freelancer-part-1-03&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how-to-survive-as-a-freelancer-part-1/04.png&quot; alt=&quot;freelancer-part-1-04&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how-to-survive-as-a-freelancer-part-1/05.png&quot; alt=&quot;freelancer-part-1-05&quot; /&gt;&lt;/p&gt;

&lt;p&gt;잘나가는 개발자 만큼은 아니지만 프리랜서를 했다고 말할 정도로 바쁘게 살고 있는 것 같다. 처음 니즈와 부합하게 폼을 이용한 설문조사 사이트, 증권사 보험 관리자 사이트, 거래소 사이트 등을 수주했다.
고객의 니즈를 파악 후 실행에 옮겨 성과까지 낸 케이스라 굉장히 스스로 만족스러웠고 프리랜서의 삶에 대해 긍정적인 시각을 가지게 해주었다.&lt;/p&gt;

&lt;h2 id=&quot;4-방향&quot;&gt;4. 방향&lt;/h2&gt;

&lt;p&gt;어떻게든 궤도에 올리는 데는 성공했다. 문의 후 성공까지 20%를 유지하고 있다. 하지만 아직 나는 아쉽다. 그래서 생각한게 과외지만 그 이야기는 추후 하는걸로 하고 앞으로의 방향에 대해서 이야기 하려고 한다.
크몽에 묶여있지만 크몽을 탈출해야 된다는게 나의 생각 중 하나이다. 결국 내가 영업을 하거나 큰 곳에 소속이 되어 일하게 되는 방향을 생각해야할 것이다. 아니면 프리모아나 위시캣에서도 활동을 고려해야 한다. 문의는 많이 들어올 수록 좋다. 스스로 부족한 점을 고칠 수 있고 좋은 경험이 되기 때문이다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;크몽 외 플랫폼에서도 활동하기&lt;/li&gt;
  &lt;li&gt;영업을 뛸수 있을 정도로 덩치 키우기&lt;/li&gt;
  &lt;li&gt;유지보수 가능한 프로젝트 하기&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;이렇게 방향을 잡았고 실행에 옮길 생각을 가지고 있다.&lt;/p&gt;

&lt;h2 id=&quot;마치며&quot;&gt;마치며&lt;/h2&gt;

&lt;p&gt;이번 시간에는 시장조사 후 상품을 내놓아서 팔기까지의 과정을 설명했다.
part 2에서는 개인 사업자 및 세금에 대해서 이야기를 해보려고 한다. 크몽의 과금 시스템에 대한 비판도 섞여있다.
또한 part 3에서는 외주로 부족한 부분을 채우기 위해서 과외까지 하고 있다는 이야기를 담아낼 것이다.&lt;/p&gt;

&lt;p&gt;이제 3년차 개발자, 1년차 프리랜서, 1년차 튜터가 되었다. 외주를 통해 누군가에게는 필요한 시스템을 공급하고, 과외를 통해서 누군가에게는 필요한 지식을 공급하고 있다.
프라이드를 가지고 사람들에게 긍정적인 영향을 줄수 있도록 노력하는 개발자가 되자.&lt;/p&gt;
</description>
        <pubDate>Sat, 16 Jan 2021 16:00:49 +0900</pubDate>
        <link>https://tech.devmaker.kr/2021/01/16/how-to-survive-as-a-freelancer-part-1</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2021/01/16/how-to-survive-as-a-freelancer-part-1</guid>
        
        <category>프리랜서</category>
        
        <category>개발자</category>
        
        
        <category>freelancer</category>
        
      </item>
    
      <item>
        <title>코틀린 기본 문법 10분 요약</title>
        <description>&lt;p&gt;&lt;img src=&quot;/assets/images/kotlin-summary/01.png&quot; alt=&quot;kotlin-summary-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;코틀린 10분 요약을 통해서 문법을 이해해보자.&lt;/p&gt;

&lt;h2 id=&quot;1-변수&quot;&gt;1. 변수&lt;/h2&gt;

&lt;p&gt;var: 변할 수 있는 변수&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;val: 변하지 않는 변수&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// error&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;2-null&quot;&gt;2. null&lt;/h2&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;1&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;?를 붙이지 않으면 null이 올수 없다.&lt;/p&gt;

&lt;h2 id=&quot;3-함수&quot;&gt;3. 함수&lt;/h2&gt;

&lt;p&gt;fun 키워드로 함수 정의&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello World!!!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;void는 생략가능.&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello World!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;한 줄로 끝날 경우 요약 가능.&lt;/p&gt;

&lt;h2 id=&quot;4-주석&quot;&gt;4. 주석&lt;/h2&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 한 줄 주석&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;/* 여러줄 주석 */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;5-문자열-템플릿&quot;&gt;5. 문자열 템플릿&lt;/h2&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;person&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;alex&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;${person.name} ${person.age}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;alex&quot;&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;$name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;6-조건문&quot;&gt;6. 조건문&lt;/h2&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;maxOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;maxOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;요약 가능.&lt;/p&gt;

&lt;h2 id=&quot;7-while-when-for&quot;&gt;7. while, when, for&lt;/h2&gt;

&lt;p&gt;while&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;cnt&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cnt&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cnt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;cnt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;++&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;when + enum&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;enum&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ZERO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;TEN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;TWENTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;THIRTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;FORTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;FIFTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;SIXTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;SEVENTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;70&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;EIGHTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;NINETY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;isMarried&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Boolean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getYears&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Int&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;when&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ZERO&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ZERO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TEN&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TEN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TWENTY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TWENTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;THIRTY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;THIRTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;FORTY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;FORTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;FIFTY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;FIFTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;SIXTY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;SIXTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;SEVENTY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;SEVENTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;EIGHTY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;EIGHTY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
            &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;NINETY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;NINETY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;person&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;alex&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getYears&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TEN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;for&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;8-class-interface&quot;&gt;8. class, interface&lt;/h2&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Clickable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;click&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;open&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Clickable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;override click&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RadioButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;RadioButton click&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;btn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RadioButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;btn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Button 클래스에 override는 오버라이드가 가능한 변경자이다.
원래라면 open을 붙여야 사용 가능해진다. 막고 싶으면 final을 명시하면 된다.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;변경자&lt;/th&gt;
      &lt;th&gt;의미&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;final&lt;/td&gt;
      &lt;td&gt;오버라이드할 수 없음(기본값)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;open&lt;/td&gt;
      &lt;td&gt;오버라이드할 수 있음&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;abstact&lt;/td&gt;
      &lt;td&gt;반드시 오버라이드해야 함&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;override&lt;/td&gt;
      &lt;td&gt;상위 클래스나 상위 인스턴스의 멤버를 오버라이드하는 중&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;9-생성자&quot;&gt;9. 생성자&lt;/h2&gt;
&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RadioButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Button&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;11111&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;$title $text&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;RadioButton click&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;btn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RadioButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;22222&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;333333&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;btn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;result:&lt;/p&gt;

&lt;p&gt;11111&lt;/p&gt;

&lt;p&gt;22222 333333&lt;/p&gt;

&lt;p&gt;init와 constructor는 중복사용이 가능하고 init가 먼저 실행된다.&lt;/p&gt;

&lt;h2 id=&quot;10-접근-제한자&quot;&gt;10. 접근 제한자&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;접근 제한자&lt;/th&gt;
      &lt;th&gt;의미&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;public&lt;/td&gt;
      &lt;td&gt;기본 값으로 누구나 접근 가능&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;private&lt;/td&gt;
      &lt;td&gt;클래스 내부에서만 접근 가능&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;protected&lt;/td&gt;
      &lt;td&gt;클래스 자신과 상속받은 클래스에서 접근 가능&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;internal&lt;/td&gt;
      &lt;td&gt;프로젝트의 모듈 안에서 누구나 접근이 가능&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;open&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MM&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;b&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;c&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;internal&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;d&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;mm&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;a, d만 실행되고 b, c는 실행되지 않습니다.&lt;/p&gt;

&lt;p&gt;a: public 가능&lt;/p&gt;

&lt;p&gt;b: private 내부에서만 가능&lt;/p&gt;

&lt;p&gt;c: 상속받아야지 가능&lt;/p&gt;

&lt;p&gt;d: 같은 모듈이라 가능&lt;/p&gt;

&lt;p&gt;-끝-&lt;/p&gt;
</description>
        <pubDate>Thu, 22 Oct 2020 18:00:49 +0900</pubDate>
        <link>https://tech.devmaker.kr/2020/10/22/kotlin-summary</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2020/10/22/kotlin-summary</guid>
        
        <category>java</category>
        
        <category>kotlin</category>
        
        
        <category>programming</category>
        
      </item>
    
      <item>
        <title>젠킨스로 CI/CD 구축하기</title>
        <description>&lt;p&gt;드디어 “CI/CD 구축하기”를 하게 되었다. 젠킨스를 도커에 올릴수 있다는 것 만으로도 신기한데 자동화된 테스트와 빌드를 구축할 수 있게 됐다는 사실에 흥분을 감출수 없었다. 
그럼 CI/CD를 이해하고 구축 과정을 알아보자.&lt;/p&gt;

&lt;h2 id=&quot;ci&quot;&gt;CI&lt;/h2&gt;

&lt;p&gt;지속적인 통합(Continuous Integration)을 의미하며 테스트 및 빌드를 자동화 하여 코드 품질을 지키는 것이다.&lt;/p&gt;

&lt;p&gt;ex) 사용자가 GitHub에 코드를 푸시 하면 Jenkins가 테스트 및 빌드를 자동으로 해준다. 그리고 그 결과를 피드백 해준다.&lt;/p&gt;

&lt;h2 id=&quot;cd&quot;&gt;CD&lt;/h2&gt;

&lt;p&gt;지속적인 서비스 제공(Continuous Delivery) 또는 지속적인 배포(Continuous Deployment)를 의미한다. CI의 연장선이며 개발자의 변경 사항을 리포지토리에서 
프로덕션 환경까지 자동으로 배포하는 것을 의미한다.&lt;/p&gt;

&lt;p&gt;ex) Jenkins에서 테스트 및 빌드가 끝나면 systemctl reload httpd.service를 통해 교체 작업을 해준다.&lt;/p&gt;

&lt;h1 id=&quot;순서&quot;&gt;순서&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;Jira와 GitHub 연동 및 워크플로우 설정&lt;/li&gt;
  &lt;li&gt;Jenkins와 GitHub 연동&lt;/li&gt;
  &lt;li&gt;Jenkins와 Slack 연동&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;jira와-github-연동-및-워크플로우-설정&quot;&gt;Jira와 GitHub 연동 및 워크플로우 설정&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-ci-cd-pipeline-in-jenkins/01.png&quot; alt=&quot;create-ci-cd-pipeline-in-jenkins-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;예전 같았으면 직접 생성을 해줬어야 했지만 지금은 GitHub 마켓에서 앱만 다운 받아도 연동이 가능하다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-ci-cd-pipeline-in-jenkins/02.png&quot; alt=&quot;create-ci-cd-pipeline-in-jenkins-02&quot; /&gt;&lt;/p&gt;

&lt;p&gt;설정이 끝났다면 Jira의 칸반보드를 열어보자. 나는 열기, 진행 중, 해결됨으로 열을 만들어봤다. 하지만 아직은 아무것도 작동 하지 않을 것이다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-ci-cd-pipeline-in-jenkins/03.png&quot; alt=&quot;create-ci-cd-pipeline-in-jenkins-03&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Jira에서는 워크플로우 라는 것을 지원한다. 여기서 이슈를 어느 열에 넣을 수 있는지를 컨트롤 한다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-ci-cd-pipeline-in-jenkins/04.png&quot; alt=&quot;create-ci-cd-pipeline-in-jenkins-04&quot; /&gt;&lt;/p&gt;

&lt;p&gt;또한 트리거를 설정하여 GitHub에서 액션 시 이슈를 원하는 열에 넣을 수 있게 된다.&lt;/p&gt;

&lt;h2 id=&quot;jenkins와-github-연동&quot;&gt;Jenkins와 GitHub 연동&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-ci-cd-pipeline-in-jenkins/05.png&quot; alt=&quot;create-ci-cd-pipeline-in-jenkins-05&quot; /&gt;&lt;/p&gt;

&lt;p&gt;자동으로 테스트, 빌드, 배포를 하기 위해서는 GitHub repo에서 git webhooks를 연동시켜줘야 한다.&lt;/p&gt;

&lt;p&gt;자세한 설정은 아래 링크를 참고하자.&lt;/p&gt;

&lt;p&gt;https://galid1.tistory.com/466&lt;/p&gt;

&lt;h2 id=&quot;jenkins와-slack-연동&quot;&gt;Jenkins와 Slack 연동&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-ci-cd-pipeline-in-jenkins/06.png&quot; alt=&quot;create-ci-cd-pipeline-in-jenkins-06&quot; /&gt;&lt;/p&gt;

&lt;p&gt;배포 결과를 실시간으로 받기 위해서 연동을 해준다.&lt;/p&gt;

&lt;p&gt;아래 링크를 참고하자.&lt;/p&gt;

&lt;p&gt;https://dnight.tistory.com/entry/Jenkins-Slack-%EC%95%8C%EB%A6%BC-%EC%97%B0%EB%8F%99&lt;/p&gt;

&lt;h1 id=&quot;결과&quot;&gt;결과&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-ci-cd-pipeline-in-jenkins/07.png&quot; alt=&quot;create-ci-cd-pipeline-in-jenkins-07&quot; /&gt;&lt;/p&gt;

&lt;p&gt;유저는 Jira를 통해 이슈를 관리 할수 있으며 git 액션에 따라 이슈 상태가 자동으로 변경된다. 또한 코드 merge 시 Jenkins는 자동으로 배포를 시작한다. 그리고 그 결과를 
 Slack으로 받을 수 있다.&lt;/p&gt;

&lt;h1 id=&quot;마치며&quot;&gt;마치며&lt;/h1&gt;

&lt;p&gt;CI/CD 툴을 전체적으로 써볼 수 있어서 좋았고 제대로 된 개발 환경을 구축했다는 사실이 너무 뿌듯했다. 다만 워크플로우는 친구의 도움으로 해결해서 그 부분이 아쉽다고 느껴졌다. 
서버를 많이 다뤄봤다고 자부하지만 아직도 실력이 부족하다고 생각이 든다. 더 열심히 하자. 끝.&lt;/p&gt;

</description>
        <pubDate>Sun, 12 Jul 2020 01:00:49 +0900</pubDate>
        <link>https://tech.devmaker.kr/2020/07/12/create-ci-cd-pipeline-in-jenkins</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2020/07/12/create-ci-cd-pipeline-in-jenkins</guid>
        
        <category>jenkins</category>
        
        <category>jira</category>
        
        <category>slack</category>
        
        <category>github</category>
        
        
        <category>project</category>
        
      </item>
    
      <item>
        <title>이지웨이 프로젝트</title>
        <description>&lt;p&gt;집을 나가기 위해서는 생각보다 많은 정보가 필요하다. 지금이 몇시 인지도 알아야 하고 혹시 비가 올수도 있으니 날씨도 알아야 한다. 또한 버스나 지하철 도착 시간도 알면 좋다.
오늘은 걱정 없이 집을 나갈 수 있게 각종 정보를 알려주는 프로젝트 EASYWAY에 대해서 소개해보려고 한다.&lt;/p&gt;

&lt;h1 id=&quot;스택&quot;&gt;스택&lt;/h1&gt;

&lt;p&gt;원래는 express와 ejs 템플릿 언어를 활용해서 프로젝트를 진행하려고 했다. 하지만 기존 스택과 비교해서 큰 변화를 줄수 있는 부분이 없다고 생각해 react로 풀어보기로 결정했다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;react&lt;/li&gt;
  &lt;li&gt;next.js&lt;/li&gt;
  &lt;li&gt;less.js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;생 react를 쓰기에는 부담이 있어 react framework인 next.js를 express와 붙여서 사용했다.
부트스트랩을 안써도 될것 같아 css에 변화를 주고자 css 프리프로세서 less.js를 도입했다.&lt;/p&gt;

&lt;h1 id=&quot;기능&quot;&gt;기능&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/about/08.png&quot; alt=&quot;easyway-project-part-1-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;전체적인 모습은 이렇다. 타이틀, 로고, 탭, 리스트, 푸터 등으로 이루어져있다. 타이틀 아래 아스팔트 이미지는 EASYWAY를 표현하고 싶어 만들어봤다.
큰 기능으로는 &lt;code&gt;수동 리프레쉬&lt;/code&gt;, &lt;code&gt;자동 리프레쉬&lt;/code&gt;, &lt;code&gt;상세 날씨보기&lt;/code&gt; 기능 등이 있다.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Header&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;EASYWAY&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Logo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Tab&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;List&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Footer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Modal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;HourlyWeather&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/Modal&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;코드 또한 UI와 최대한 일치하게 작성해봤다.&lt;/p&gt;

&lt;h2 id=&quot;수동-리프레쉬&quot;&gt;수동 리프레쉬&lt;/h2&gt;

&lt;p&gt;기본적으로 받아온 시간으로부터 시간이 지나 0초가 되면 자동 리프레쉬 하도록 설계되어 있지만 지하철과 버스 도착 정보는 실시간으로 바뀌기 때문에 정확하게 알고 싶을 때는 수동으로 리프레쉬 해주면 된다.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Tab&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;List&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Modal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;HourlyWeather&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Modal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;버튼 클릭 시 부모 refresh state가 true가 되고 자식 props에 전달되어 진다.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;componentWillReceiveProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;nextProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;any&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;nextProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;이때 componentWillReceiveProps에서 체크해 액션을 취한다.&lt;/p&gt;

&lt;h2 id=&quot;자동-리프레쉬&quot;&gt;자동 리프레쉬&lt;/h2&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UI&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;setWaitingTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JQuery&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;HTMLElement&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;interval&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Interval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;interval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;minute&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;minute_message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;minute&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;분&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sec_message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;minute&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;초&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;minute_message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sec_message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;sec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;interval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;clear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;공을 들여 설계한 기능이다. API를 호출해서 받아온 도착 시간을 setInterval() 함수에 넣어주고 0초가 되면 다시 호출해주는 재귀 시스템이다.&lt;/p&gt;

&lt;h2 id=&quot;상세-날씨보기&quot;&gt;상세 날씨보기&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/easyway-project-part-1/02.png&quot; alt=&quot;easyway-project-part-1-02&quot; /&gt;&lt;/p&gt;

&lt;p&gt;현재 날씨를 가지고는 미래 날씨를 예측할 수 없었다. 우산을 가지고 나가려고 해도 언제 비가 그치는지 다시 내리는지 알수 없었기 때문이다.
해당 문제를 해결하기 위해 API 문서를 뒤져봤는데 다행히 3시간 간격으로 미래 날씨를 알려주는 API가 있었다.
여기까지는 아주 쉽게 풀수 있었다. 하지만 UI로 풀기 위해서는 Modal창이 필요했고 Modal 컴포넌트를 만들어야 했다.
프론트 개발자가 아닌 나는 당장 만들수 없었고 리서치를 해봤다. 개인 모달 코드를 참고하기도 했고 부트스트랩 모달 코드를 보기도 했다. 하지만 명쾌한 답을 얻을 수는 없었다.
한숨을 쉬면서 고민하던 와중 html 강의 사이트에서 Modal 강좌를 볼수 있었고 답을 얻을 수 있었다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;모달 화면 밖을 클릭하면 창이 닫혀야 한다.&lt;/li&gt;
  &lt;li&gt;모달 화면을 제외하고는 모든 화면은 검게 보여야 한다.&lt;/li&gt;
  &lt;li&gt;스크롤 위치와 상관없이 상단에 모달을 표시해야 한다.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Modal&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;active&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.modal, .modal-dialog&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;deactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.modal, .modal-dialog&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nf&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.modal-close&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Modal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()};&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.modal&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;modal&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Modal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()};&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;modal&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;modal-dialog&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;modal-header&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;modal-close&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
              &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/static/img/close_btn_01.svg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;          &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;          &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;modal-content&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;active와 deactive를 static 함수로 작성하여 언제든지 모달창을 외부에서 제어 가능하게 만들었다.
componentDidMount에서는 모달창 밖을 클릭하거나 닫기 버튼을 클릭하면 창이 종료될 수 있게 만들었다.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Modal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;HourlyWeather&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/Modal&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;{this.props.children}을 활용해 Modal 속을 채웠다.&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.modal&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;fixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;auto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;-ms-overflow-style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;&amp;amp;::-webkit-scrollbar&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;.modal을 position: fixed로 주고 width와 height를 100%로 설정해 스크롤 위치와 상관없이 Modal창을 상단에 표시할 수 있게 되었다.
이중 스크롤바는 &amp;amp;::-webkit-scrollbar 옵션을 통해 없애줬다.&lt;/p&gt;

&lt;h2 id=&quot;따라다니는-탭&quot;&gt;따라다니는 탭&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/easyway-project-part-1/03.png&quot; alt=&quot;easyway-project-part-1-03&quot; /&gt;&lt;/p&gt;

&lt;p&gt;모바일 화면 시 스크롤이 길어지면 상단 리프레쉬 버튼이 안보인다. 그래서 따라다니는 탭을 적용해 해결했다.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;changeTabMode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#title&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#logo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.tab&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;scroll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;windowHeight&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;scrollTop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;windowHeight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.tab&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;removeClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;tab&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mini-tab&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#list&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;margin-top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;325px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.mini-tab&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;removeClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mini-tab&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;tab&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#list&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;margin-top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;-50px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;height를 계산해 적용해줬다.&lt;/p&gt;

&lt;h1 id=&quot;마치며&quot;&gt;마치며&lt;/h1&gt;

&lt;p&gt;공공 데이터를 활용해 프로젝트를 진행해봤다. API에 대해서는 몇가지 아쉬운 점들이 있었지만 내가 원하는 사이트를 만들기에는 부족함이 없어 어느정도 만족한다.
개인이 얻기 힘든 데이터가 공공 데이터로 나와 있어 이것을 가지고 작은 힘으로 큰 결과물을 만들 수 있어서 그 점이 너무 좋았다. 사이트도 디자인을 참고해서 만들었지만 깔끔하게 나와서 좋았다.
걱정 없이 집을 나갈 수 있게 각종 정보를 알려주는 프로젝트 EASYWAY 최근 진행했던 프로젝트 중에서는 가장 알맹이가 있는 프로젝트가 아니였을까 싶다.
실제로 집을 나갈 때 사용하기도 할꺼고 발전 가능성도 큰 프로젝트이다. 기회가 된다면 더 개발해 나만 사용하는 사이트가 아닌 모두가 사용 가능한 사이트로 만들어보고 싶은 욕심이 생겼던 프로젝트이다. 하지만 아직은 나만 사용할꺼기 때문에 여기까지 진행할것이다. 끝!&lt;/p&gt;
</description>
        <pubDate>Mon, 12 Aug 2019 21:00:49 +0900</pubDate>
        <link>https://tech.devmaker.kr/2019/08/12/easyway-project-part-1</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2019/08/12/easyway-project-part-1</guid>
        
        <category>react</category>
        
        <category>next.js</category>
        
        
        <category>project</category>
        
      </item>
    
      <item>
        <title>도커로 웹 서비스 배포하기</title>
        <description>&lt;p&gt;개인 프로젝트를 진행하면서 만든 사이트 수가 제법 된다. 오늘은 도커로 여러 웹 서비스들을 하나로 묶어 관리한 이야기를 해보려고 한다.&lt;/p&gt;

&lt;h1 id=&quot;elb&quot;&gt;ELB&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/deploy-web-service-with-docker/01.png&quot; alt=&quot;deploy-web-service-with-docker-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;각각의 서비스들은 docker로 돌아가며 고유 포트번호를 가지고 있다. ELB는 도메인을 해당 포트로 리다이렉션 해주고 있다.
ACM에서 발급받은 인증서를 통해 https도 지원해 준다. 이 구조는 한 달도 못가 바꾸게 되었다. 무엇이 문제였을까?
바로 돈이였다.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;1 load balancers x 0.025 USD x 730 hours in a month = 18.25 USD&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;한 개의 웹 서비스는 한 개의 로드밸런서를 가져야 한다. 이 구조의 치명적인 약점으로 결국 내 돈 $25.24를 가져갔다. &lt;del&gt;진짜 얄짤 없이 가져가더라.&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;무작정 서비스하고 치룬 대가였다. 그렇게 구조를 바꾸게 된 계기였다.&lt;/p&gt;

&lt;h1 id=&quot;apache&quot;&gt;Apache&lt;/h1&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;VirtualHost &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;:80&amp;gt;
    ServerName gureuso.me
    ServerAlias apis.movie.gureuso.me

    ProxyPass / http://gureuso.me:5001/
    ProxyPassReverse / http://gureuso.me:5001/
&amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ELB 일을 대신 해줄 녀석이 필요했다. 아파치 프록시 기능을 사용하기로 했다. 해당 도메인으로 접근 시 서비스에 맞는 포트번호로 연결 해주게 했다.&lt;/p&gt;

&lt;p&gt;https는 인증서 비용 때문에 포기하기로 했다. &lt;del&gt;가난한 개발자의 슬픔이다.&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;설계를 바꾸긴 했지만 도메인을 서비스에 연결하는 것은 똑같이 구현했다.&lt;/p&gt;

&lt;h1 id=&quot;docker&quot;&gt;Docker&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-the-cinema-homepage-part-3/02.png&quot; alt=&quot;create-the-cinema-homepage-part-3-02&quot; /&gt;&lt;/p&gt;

&lt;p&gt;본론으로 돌아와서 이번에는 도커 관리에 문제가 생겼다. 웹 서비스들의 수가 늘면서 관리해야 할 도커 컨테이너들이 많아진 것이다.&lt;/p&gt;

&lt;p&gt;운영하고 있는 서비스들은 APP, API, DB 등이 docker network로 묶여 있는 구조이다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

docker stop admin_db
docker &lt;span class=&quot;nb&quot;&gt;rm &lt;/span&gt;admin_db

docker build &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; admin_db:0.1  &lt;span class=&quot;nt&quot;&gt;--no-cache&lt;/span&gt; /root/docker/mysql
docker run &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;MYSQL_DATABASE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;admin &lt;span class=&quot;nt&quot;&gt;--net&lt;/span&gt; admin &lt;span class=&quot;nt&quot;&gt;--name&lt;/span&gt; admin_db admin_db:0.1 &lt;span class=&quot;nt&quot;&gt;--character-set-server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;utf8mb4 &lt;span class=&quot;nt&quot;&gt;--collation-server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;utf8mb4_unicode_ci
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;커맨드는 run.sh 쉘 스크립트를 만들어서 관리하고 있고, 서버들은 docker network로 격리되어 있지만 결국 컨테이너 하나 씩 컨트롤 하고 있는 중이다.&lt;/p&gt;

&lt;p&gt;한 서비스에 묶여 있는 도커 컨테이너들을 하나로 관리해야 할 필요성이 생긴 것이다.&lt;/p&gt;

&lt;p&gt;결국 docker-compose를 도입하게 되었다.&lt;/p&gt;

&lt;h1 id=&quot;docker-compose&quot;&gt;Docker Compose&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;Compose is a tool for defining and running multi-container Docker applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;여러 개의 도커 컨테이너들을 정의하고 실행하게 해주는 툴이라고 한다. &lt;del&gt;요즘 세상에는 이미 다 만들어져 있어서 잘 찾고 잘 쓰는 요령만 있어도 먹고 살것 같다는 생각이 종종 든다.&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;아무튼 run.sh 쉘 스크립트를 docker-compose.yml로 마이그레이션 하게 되었다.&lt;/p&gt;

&lt;div class=&quot;language-yml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;3&apos;&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;proxy&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx:latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;ports&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;8000:8000&apos;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;volumes&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./nginx/default.conf:/etc/nginx/conf.d/default.conf&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./turnthepage:/var/www/turnthepage&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;depends_on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;web&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;web&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;bash -c &apos;dockerize -wait tcp://db:3306 -timeout 30s &amp;amp;&amp;amp; python manage.py makemigrations &amp;amp;&amp;amp; python manage.py migrate &amp;amp;&amp;amp; gunicorn --bind 0.0.0.0:8000 conf.wsgi:application&apos;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;environment&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;DJANGO_SETTINGS_MODULE=conf.settings.product&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;DB_USER_PASSWD=password&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;DB_HOST=db&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;depends_on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;db&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;volumes&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./turnthepage:/root/turnthepage&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;expose&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;8000&apos;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql:5.7&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;environment&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;MYSQL_ROOT_PASSWORD=password&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;MYSQL_DATABASE=turnthepage&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;volumes&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./mysql/my.cnf:/etc/mysql/conf.d/my.cnf&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;db:/var/lib/mysql&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;volumes&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;도커 커맨드를 옮긴 거라서 크게 설명할 부분은 없는 것 같다. 짚고 넘어가야 할 부분은 depends_on과 dockerize이다.&lt;/p&gt;

&lt;p&gt;depends_on은 실행 순서에만 관여하고 완료까지는 간섭하지 않는다. 이렇게 될 경우 db -&amp;gt; web -&amp;gt; proxy 순으로 실행되지만 
db가 web보다 늦게 완료될 경우 db 연결을 하지 못하고 web 서비스가 종료될 수 있다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt;: bash &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;dockerize -wait tcp://db:3306 -timeout 30s &amp;amp;&amp;amp; python manage.py makemigrations &amp;amp;&amp;amp; python manage.py migrate &amp;amp;&amp;amp; gunicorn --bind 0.0.0.0:8000 conf.wsgi:application&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;이 문제를 dockerize가 해결해주고 있다. dockerize는 커넥션이 될때까지 wait 해주는 녀석으로 앞서 말한 커넥션 종료 상황을 방지해준다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- db:/var/lib/mysql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;volumes를 빼먹었는데 DB 컨테이너가 사라질 경우 data도 같이 사라져 버린다. docker volume을 이용해서 컨테이너와 상관없이 데이터를 유지할 수 있게 만들었다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/deploy-web-service-with-docker/02.png&quot; alt=&quot;deploy-web-service-with-docker-02&quot; /&gt;&lt;/p&gt;

&lt;p&gt;해당 docker-compose.yml을 도식화했다. 기존 구조는 그대로지만 관리에 차이가 생겼다. 
예전에는 수 많은 컨테이너들을 커맨드로 일일이 관리했다면, 지금은 도식처럼 docker network 단위로 관리가 가능해졌다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@ip-172-31-16-249 ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                            NAMES
1604b63b47d4        nginx:latest        &lt;span class=&quot;s2&quot;&gt;&quot;nginx -g &apos;daemon of…&quot;&lt;/span&gt;   45 hours ago        Up 45 hours         80/tcp, 0.0.0.0:8001-&amp;gt;8001/tcp   admin_proxy_1
f739a6076b5e        admin_web           &lt;span class=&quot;s2&quot;&gt;&quot;bash -c &apos;dockerize …&quot;&lt;/span&gt;   45 hours ago        Up 45 hours         8000/tcp                         admin_web_1
ab5bd7325008        mysql:5.7           &lt;span class=&quot;s2&quot;&gt;&quot;docker-entrypoint.s…&quot;&lt;/span&gt;   45 hours ago        Up 45 hours         3306/tcp, 33060/tcp              admin_db_1
71f4d9eb3f06        nginx:latest        &lt;span class=&quot;s2&quot;&gt;&quot;nginx -g &apos;daemon of…&quot;&lt;/span&gt;   45 hours ago        Up 45 hours         80/tcp, 0.0.0.0:8000-&amp;gt;8000/tcp   turnthepage_proxy_1
3be906e7182b        turnthepage_web     &lt;span class=&quot;s2&quot;&gt;&quot;bash -c &apos;dockerize …&quot;&lt;/span&gt;   45 hours ago        Up 45 hours         8000/tcp                         turnthepage_web_1
fef5eb879c68        mysql:5.7           &lt;span class=&quot;s2&quot;&gt;&quot;docker-entrypoint.s…&quot;&lt;/span&gt;   45 hours ago        Up 45 hours         3306/tcp, 33060/tcp              turnthepage_db_1
f2584f1c3468        nginx:latest        &lt;span class=&quot;s2&quot;&gt;&quot;nginx -g &apos;daemon of…&quot;&lt;/span&gt;   46 hours ago        Up 46 hours         80/tcp, 0.0.0.0:5000-&amp;gt;5000/tcp   flask_proxy_1
79f86c54a0f6        flask_web           &lt;span class=&quot;s2&quot;&gt;&quot;bash -c &apos;dockerize …&quot;&lt;/span&gt;   46 hours ago        Up 46 hours         5000/tcp                         flask_web_1
35cb5bca4a7f        mysql:5.7           &lt;span class=&quot;s2&quot;&gt;&quot;docker-entrypoint.s…&quot;&lt;/span&gt;   46 hours ago        Up 46 hours         3306/tcp, 33060/tcp              flask_db_1
da726b72406f        nginx:latest        &lt;span class=&quot;s2&quot;&gt;&quot;nginx -g &apos;daemon of…&quot;&lt;/span&gt;   46 hours ago        Up 46 hours         80/tcp, 0.0.0.0:5001-&amp;gt;5001/tcp   movie_proxy_1
7d806a2f923b        movie_api           &lt;span class=&quot;s2&quot;&gt;&quot;bash -c &apos;dockerize …&quot;&lt;/span&gt;   46 hours ago        Up 46 hours         5000/tcp                         movie_api_1
1ec7eb548bb5        movie_web           &lt;span class=&quot;s2&quot;&gt;&quot;bash -c &apos;npm run st…&quot;&lt;/span&gt;   46 hours ago        Up 46 hours         0.0.0.0:3000-&amp;gt;3000/tcp           movie_web_1
0c02bcaf7c5d        mysql:5.7           &lt;span class=&quot;s2&quot;&gt;&quot;docker-entrypoint.s…&quot;&lt;/span&gt;   46 hours ago        Up 46 hours         3306/tcp, 33060/tcp              movie_db_1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;이제 이 많은 컨테이너들을 4개의 docker-compose로 관리가 가능해졌다.&lt;/p&gt;

&lt;h1 id=&quot;마치며&quot;&gt;마치며&lt;/h1&gt;

&lt;p&gt;도커와 프록시 기능을 활용해서 서버 배포를 진행해봤다. docker-compose 기능을 활용해서 쉬운 배포를 가능하게 했고, proxy를 통해 도메인 별로 서비스를 가능하게 했다.
개발하면서 느낀점은 뭐든 쉽고 편리해야지 좋은 서비스고 좋은 기능인것 같다. 쉽고 강력한 도커 기능들 덕분에 제법 그럴싸한 배포를 할수 있게 되었다. 이제 배포 시 도커를 빼놓고 이야기 할수 없게 된것 같다.&lt;/p&gt;

&lt;p&gt;이번 경험을 통해서 더 큰 서비스에서는 도커를 어떻게 활용할 수 있을까? 라는 욕심을 생기게 해준 계기가 된것 같다. 좋은 경험이였다.&lt;/p&gt;
</description>
        <pubDate>Mon, 27 May 2019 17:56:49 +0900</pubDate>
        <link>https://tech.devmaker.kr/2019/05/27/deploy-web-service-with-docker</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2019/05/27/deploy-web-service-with-docker</guid>
        
        <category>docker</category>
        
        <category>docker-compose</category>
        
        
        <category>server</category>
        
      </item>
    
      <item>
        <title>영화 예매 사이트 개발하기 part 3</title>
        <description>&lt;p&gt;Flask로 만들었던 영화 예매 사이트를 React &amp;amp; Next.js로 이전하면서 겪었던 삽질 이야기를 해보려고 한다.&lt;/p&gt;

&lt;h1 id=&quot;스택&quot;&gt;스택&lt;/h1&gt;

&lt;p&gt;back-end:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Flask&lt;/li&gt;
  &lt;li&gt;Express&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;front-end:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Jquery&lt;/li&gt;
  &lt;li&gt;Bootstrap4&lt;/li&gt;
  &lt;li&gt;React&lt;/li&gt;
  &lt;li&gt;Next.js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;database:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;MySQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;server:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Docker&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;react&quot;&gt;React&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;React는 사용자 인터페이스를 만들기위해 페이스북과 인스타그램에서 개발한 오픈소스 
자바스크립트 라이브러리로써, 사용자 인터페이스(User Interface)에 집중하며, 
Virtual DOM을 통해 속도와 편의를 높이고, 단방향 데이터플로우를 지원하여 보일러플레이트 
코드를 감소시켜, 많은 사람들이 React를 MVC의 V를 고려하여 선택합니다. 즉, React는 
지속해서 데이터가 변하는 대규모어플리케이션의 구축이라는 하나의 문제를 풀기 위해서 
만들어졌습니다.
http://webframeworks.kr/getstarted/reactjs/#tocAnchor-1-1&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;처음에 이해하지 못했던 부분이 자체 서버를 구동하는 것을 보고 Django나 Flask 서버 
프레임워크로 착각해버렸다. 사실은 MVC에 V역할을 하는 앱이였는데 말이다. 
그동안 내가 해왔던 프론트 프로그래밍은 html css jquery 수준으로 객체지향과는 거리가 
먼 사이였다. 하지만 React를 접하고 나서는 프론트에서도 객체지향을 할수 있구나와 
프론트 수준이 많이 올라 선 것을 느낄 수 있었다.&lt;/p&gt;

&lt;h1 id=&quot;nextjs&quot;&gt;Next.js&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;2016년 10월에 Zeit.co 팀에 의해 발표된 React JS를 이용한 서버 사이드 
렌더링 프레임워크 (SSR)
http://webframeworks.kr/tutorials/nextjs/nextjs-001/#tocAnchor-1-1&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;사실 Next.js 기능은 거의 사용 안하고 프로젝트 구조만 활용하는 쪽을 선택했다. 
단순함과 깔끔한 구조가 내눈을 사로잡았다.&lt;/p&gt;

&lt;h1 id=&quot;flask&quot;&gt;Flask&lt;/h1&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@app.route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;methods&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;movies&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;movies&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;asdict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;movie&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;movies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;기존 Flask로 만들어진 영화 예매 사이트를 API 서버로 만들어야 했다. 
랜더링 하는 부분을 전부 지우고 JSON을 리턴하게 변경했다.&lt;/p&gt;

&lt;h2 id=&quot;프로젝트-구조&quot;&gt;프로젝트 구조&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-the-cinema-homepage-part-3/01.png&quot; alt=&quot;create-the-cinema-homepage-part-3-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;pages에 .js 파일을 생성하면 이름과 URL이 일치된다. index.js 파일을 생성하면 / URL이 생성된다.
static에는 js, css, images가 들어 있고 components에는 Layout과 Header 등 사이트 뼈대를 담당하는 코드가 들어있다.
server.js는 express로 만들어 졌는데 왜 express를 사용하게 됐는지는 이따 설명하려고 한다.&lt;/p&gt;

&lt;h2 id=&quot;랜더링&quot;&gt;랜더링&lt;/h2&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;card-columns&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  for movie in movies
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;card&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;card-img-top&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ movie.poster_url }}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;poster image&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;card-body&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;h4&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;card-title&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;{{ movie.title }}&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h4&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;card-text&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;{{ movie.description }}&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;list-group list-group-flush&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;list-group-item&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;감독: {{ movie.director }}&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;list-group-item&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;러닝타임: {{ movie.running_time }}분&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;list-group-item&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;관람가: {{ movie.age_rating }}세 이상 관람가&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;br&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/v1/cinemas?movie_id={{ movie.id }}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;btn btn-primary&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;예매하기&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  endfor
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Movies&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;create_movies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;movies&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;movie_list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;movies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;movie_list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;card&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;card-img-top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;poster_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poster image&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;card-body&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;h4&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;card-title&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
              &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/movies/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/a&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/h4&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;card-text&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/p&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ul&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;list-group list-group-flush&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
              &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;list-group-item&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;감독&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;director&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/li&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;              &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;list-group-item&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;러닝타임&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;running_time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;분&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/li&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;              &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;list-group-item&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;관람가&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;age_rating&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;세&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;이상&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;관람가&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/li&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/ul&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/cinemas?movie_id=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;movie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;btn btn-primary&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;예매하기&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/a&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;          &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;      &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;movie_list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layout&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Movies&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;card-columns&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;create_movies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()}&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/div&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/Layout&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;사실 적응이 많이 필요했던 부분인게 두 코드는 비슷해 보이지만 if else 사용 방법 등에서 차이가 있다.
파이썬에서는 php 처럼 코드 사이에 if else가 자유로운 반면에 React에서는 미리 코드를 통해 정의하고 랜더링 시 데이터 그대로 표시되게 된다.
물론 방법이야 있겠지만 직관적으로 코딩하기에는 제약사항이 많았다.&lt;/p&gt;

&lt;h2 id=&quot;데이터-초기화&quot;&gt;데이터 초기화&lt;/h2&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getInitialProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fetch_uri&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https://apis.movie.gureuso.me/v1/movies&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fetch_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;MVC의 V를 담당하는 앱답게 서버 요청을 받아서 데이터를 초기화 한다. 이 데이터를 가지고 랜더링을 하게 된다.&lt;/p&gt;

&lt;h2 id=&quot;restful-구현&quot;&gt;RESTful 구현&lt;/h2&gt;

&lt;p&gt;아까 pages에 index.js 생성시 / URL이 생성된다고 했다. 그럼 &lt;code&gt;/movies/1&lt;/code&gt; URL을 생성하려면 어떻게 해야할까?
여기서부터 골을 열심히 때리면서 생각해봤다. Doc에서는 외부 서버를 사용해야 한다고 하는데 
이해가 잘안되고 내부 코드를 사용시 이상하게 작동하고 머리만 아퍼가던 중 결국 외부 서버를 
만들어서 해결했다. 그게 바로 Express 서버이다.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/movies/:id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;page&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/movie&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;params&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;/movies/1&lt;/code&gt; URL을 요청하면 &lt;code&gt;movies/1.js&lt;/code&gt; 파일을 찾게 된다. 이 부분을 Express 라우팅을 통해 해결했다.&lt;/p&gt;

&lt;h2 id=&quot;spa&quot;&gt;SPA&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-the-cinema-homepage-part-3/04.gif&quot; alt=&quot;create-the-cinema-homepage-part-3-04&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Link&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;next/link&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Link&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/theaters/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showtime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;theater&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/showtimes/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showtime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//code&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/a&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Next.js에서는 위와 같이 코딩만 해주면 싱글 페이지 앱이 완성된다. 진짜 편하게 만들어 놨다.&lt;/p&gt;

&lt;h2 id=&quot;배포&quot;&gt;배포&lt;/h2&gt;

&lt;p&gt;배포 시 도커만한게 없더라. 평소처럼 DB 생성하고 API 연결하고 APP을 만들었다.&lt;/p&gt;

&lt;div class=&quot;language-dockerfile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; node:10.15.3&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;MAINTAINER&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; gureuso &amp;lt;gureuso.github.io&amp;gt;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; root&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WORKDIR&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; /root&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# nextjs&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;git clone https://github.com/gureuso/movie.git
&lt;span class=&quot;k&quot;&gt;WORKDIR&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; /root/movie&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;CMD&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; npm run start&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;EXPOSE&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; 3000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-the-cinema-homepage-part-3/02.png&quot; alt=&quot;create-the-cinema-homepage-part-3-02&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;마치며&quot;&gt;마치며&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/create-the-cinema-homepage-part-3/03.png&quot; alt=&quot;create-the-cinema-homepage-part-3-03&quot; /&gt;&lt;/p&gt;

&lt;p&gt;많은 API를 활용해서 화려하게는 만들지 못했지만 React를 체험하기 좋은 시간이였던 것 같다. 
러닝커브가 높아진 만큼 배움의 가치를 느낄수 있어서 좋았다. 
아직 용어 이해가 안되는 부분이 좀 있는데 복습하면서 다시 공부해봐야겠다.&lt;/p&gt;
</description>
        <pubDate>Wed, 01 May 2019 22:13:49 +0900</pubDate>
        <link>https://tech.devmaker.kr/2019/05/01/create-the-cinema-homepage-part-3</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2019/05/01/create-the-cinema-homepage-part-3</guid>
        
        <category>react</category>
        
        <category>node.js</category>
        
        <category>next.js</category>
        
        
        <category>project</category>
        
      </item>
    
      <item>
        <title>턴더페 프로젝트 part 3</title>
        <description>&lt;p&gt;이번 편에서는 Docker와 AWS ELB를 활용해 서버를 구현한 이야기를 해보려고 한다.&lt;/p&gt;

&lt;h1 id=&quot;server&quot;&gt;Server&lt;/h1&gt;

&lt;h2 id=&quot;docker&quot;&gt;Docker&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/turnthepage-project-part-3/01.png&quot; alt=&quot;turnthepage-project-part-3-01&quot; /&gt;&lt;/p&gt;

&lt;p&gt;비용 문제로 EC2 프리티어를 가지고 구현하게 됐다.&lt;/p&gt;

&lt;div class=&quot;language-dockerfile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; python:3.5&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;MAINTAINER&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; gureuso &amp;lt;wyun13043@gmail.com&amp;gt;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; root&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WORKDIR&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; /root&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;#base&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;apt-get &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; update
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;apt-get &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;python3-pip

&lt;span class=&quot;c&quot;&gt;#django&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;git clone https://github.com/gureuso/turnthepage.git
&lt;span class=&quot;k&quot;&gt;WORKDIR&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; /root/turnthepage&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;pip &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; requirements.txt

&lt;span class=&quot;k&quot;&gt;EXPOSE&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; 8000&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;CMD&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; python manage.py makemigrations;python manage.py migrate;python manage.py runserver --insecure&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;장고 앱 배포를 위해 Dockerfile을 작성했다. 프로젝트는 깃허브에 올려 git clone으로 가져오게 했다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker build &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; turnthepage:0.1 &lt;span class=&quot;nt&quot;&gt;--no-cache&lt;/span&gt; /root/docker/turnthepage
docker build &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; mysql:0.1 &lt;span class=&quot;nt&quot;&gt;--no-cache&lt;/span&gt; /root/docker/mysql

docker run &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--net&lt;/span&gt; turnthepage &lt;span class=&quot;nt&quot;&gt;--name&lt;/span&gt; db mysql:0.1 &lt;span class=&quot;nt&quot;&gt;--character-set-server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;utf8mb4 &lt;span class=&quot;nt&quot;&gt;--collation-server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;utf8mb4_unicode_ci
docker run &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--net&lt;/span&gt; turnthepage &lt;span class=&quot;nt&quot;&gt;--name&lt;/span&gt; turnthepage &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 8000:8000 &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;DB_HOST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;172.18.0.2 turnthepage:0.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;turnthepage 네트워크를 만들어 APP과 DB를 묶어 내부 통신 가능하게 만들었다.&lt;/p&gt;

&lt;h2 id=&quot;aws-elb&quot;&gt;AWS ELB&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/turnthepage-project-part-3/02.png&quot; alt=&quot;turnthepage-project-part-3-02&quot; /&gt;&lt;/p&gt;

&lt;p&gt;gureuso.me 도메인을 구입하게 되었다. 도메인을 구입한 기념으로 turnthepage 프로젝트를 book.gureuso.me에 연결하게 되었다.&lt;/p&gt;

&lt;p&gt;AWS에서 도메인을 구입하게 되면 ACM에서 발급 받은 인증서를 통해 ELB에 SSL를 적용할 수 있게 된다. 즉 https://book.gureuso.me 가 가능해진다는 것이다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/turnthepage-project-part-3/03.png&quot; alt=&quot;turnthepage-project-part-3-03&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# SSL/HTTPS
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SECURE_PROXY_SSL_HEADER&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HTTP_X_FORWARDED_PROTO&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;https&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;SECURE_SSL_REDIRECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;https가 가능해졌고 http로 접속시 https로 리다이렉션 되게 해야했다. 이 부분은 장고 옵션을 통해 해결했다.&lt;/p&gt;

&lt;h1 id=&quot;마치며&quot;&gt;마치며&lt;/h1&gt;

&lt;p&gt;미루고 왔던 프로젝트가 드디어 끝났다. 차차 업그레이드를 통해 기능을 발전시킬 예정이다. 안드로이드 책 다 읽기가 목표인데 꾸준히 기록해서 클리어까지 해봐야겠다. 클리어 하면 안드로이드 프로젝트가 나를 기다리고 있겠지..&lt;/p&gt;

&lt;p&gt;어쨌든 새로 배운 장고를 활용해 만든 첫 프로젝트 치고는 나쁘지 않았다.&lt;/p&gt;

&lt;p&gt;끝.&lt;/p&gt;
</description>
        <pubDate>Wed, 10 Apr 2019 17:22:30 +0900</pubDate>
        <link>https://tech.devmaker.kr/2019/04/10/turnthepage-project-part-3</link>
        <guid isPermaLink="true">https://tech.devmaker.kr/2019/04/10/turnthepage-project-part-3</guid>
        
        <category>aws</category>
        
        <category>elb</category>
        
        <category>docker</category>
        
        
        <category>project</category>
        
      </item>
    
  </channel>
</rss>