Eugene Yoo

캡스톤 디자인2 커밋

Showing 362 changed files with 5064 additions and 2 deletions
1 -# 프로젝트 주제: 최신 웹 구조 습득 및 실습
2 -React, Vue, Apollo, Graph.QL과 같은 최신 웹 기술을 사용하여 퍼포먼스도 뛰어나고 유연한 웹서비스를 구현해보도록 한다.
...\ No newline at end of file ...\ No newline at end of file
1 +# 캡스톤 디자인 2 주제: 최신 웹 구조 습득 및 실습
2 +# 프로젝트 주제: React와 오픈 API를 활용한 최신 웹 구조 습득 및 실습
3 +## 컴퓨터 공학과 2016104135 - 유유진
4 +React, Vue, Apollo, Graph.QL과 같은 최신 웹 기술을 사용하여 퍼포먼스도 뛰어나고 유연한 웹서비스를 구현해보도록 한다.
5 +
6 +# 실행 방법
7 +
8 +프로젝트 소스코드 폴더에서 **npm install .**로 모듈을 설치한 뒤 터미널에 **C:/`{프로젝트 위치}`> yarn dev**를 치면 실행된다.
9 +*데이터를 제외하고 업로드해서 정상적인 작동은 하지 않습니다. 시연 때 보신 결과와 최종보고서 및 실행결과 사진을 확인해주세요.*
10 +
11 +
12 +# 폴더 구성 설명
13 +
14 +## 면담 보고서
15 +각 월별 면담 보고서 (3~6)월 면담보고서가 들어 있습니다. 대면 면담을 한 것은 사진을 첨부했고, 서면으로 면담한 것은 사진이 첨부되어 있지 않습니다.
16 +
17 +## 진행과제
18 +프로젝트를 진행하기에 앞서 필요한 지식을 습득하기 위해 HTML + CSS + JavaScript를 공부, 실습하는 과제를 내주셨고 관련 과제 결과를 담았습니다.
19 +
20 +## 진행 보고서
21 +캡스톤 디자인 2를 진행하면서 제출한 보고서를 담았습니다. 주제(프로젝트 계획), 중간, 기말보고서로 나뉩니다.
22 +
23 +## 프로젝트
24 +프로젝트 하면서 작성한 소스코드를 모았습니다. 크롤러, 프로젝트, 실행결과 사진이 있고 추가로 웹페이지 기획안과 최종발표자료까지 함께 들어있습니다.
25 +
26 +실행결과 사진은 탭 순서대로 구성되어 있습니다. 검색 결과는 1~5까지 있는데 검색 결과 Top3와 원형 그래프, 그 아래에 나오는 요일 별 수치를 보여주는 막대 그래프 캡처로 구성되어 있습니다.
27 +
28 +
29 +
30 +
31 +
32 +
33 +
34 +
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +
4 +<head>
5 + <meta charset="utf-8">
6 + <title>회원가입</title>
7 + <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
8 + <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
9 + <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
10 + <script>
11 + $(function () {
12 + $("#datepicker").datepicker();
13 + //여기 #은 id인데 <p>Date: <input type="text" id="datepicker"></p> 이렇게 넣을때
14 + //type은 text id를 datepicker로 사용
15 + });
16 + </script>
17 + <style>
18 + .ui-widget-header {background:navy; color:#fff;}
19 + .btn{width: 100px; height:50px; background: none; border:none; padding:0;}
20 + /*크기 설정 해주고 background, border, padding을 none, 0으로 초기화*/
21 + button img{width:90%;}/*부모(button)가 할당해준 값에서 최대치를 사용하도록 설정해서 button도 설정이 들어가게*/
22 + </style>
23 +</head>
24 +
25 +<body>
26 + <form action="#" method="POST">
27 + <!-- 전송될 무언가는 반드시 form으로 감싸져야한다.,
28 + 이게 어디로 전송될지 action 다음 스크립트 파일을 적어주면 된다.-->
29 + <!--서버에 어떻게 전송할지에 대한 방법이 적혀야함(method) form옆에는 반드시 따라붙음 -->
30 + <!-- post = 암호화, get 암호화x 주소표시줄에 같이 표시되서 묻어간다.-->
31 + <!-- 개발자 도구에서 확인해보면 옆에 메소드가 붙어있음 회원가입은 암호화해야하니까 post-->
32 + <fieldset>
33 + <!--필드셋으로 묶고 legend 라벨링-->
34 + <legend>필수 입력 사항</legend>
35 + <p>
36 + <label for="name">이름: </label>
37 + <input id="name" type="text" name="username">
38 + <!--name 데이터베이스의 필드(애트리뷰트)명이다.-->
39 + <!-- 경우 프로그래머끼리 협의를 보거나 백앤드 작업자를 위해 비워두고 커스텀하게 한다.-->
40 + </p>
41 + <!--패러그래프: tab 역할을 한다.-->
42 + <p>
43 + <label for="email">이메일: </label>
44 + <input id="email" type="email" name="useremail">
45 + <!--input(사용자 입력 가능칸) label 붙어 있어야 한다 이때 적절한 id 주자 id==for 매치-->
46 + <!-- input에는 type 있는데 type 설정해서 우리가 원하는 형태로 데이터를 받을 있음 -->
47 + <!-- email type 걸면 브라우저가 이메일 형식 이외의 것을 차단함-->
48 + </p>
49 + <p>
50 + <label for="password">비밀번호: </label>
51 + <input id="password" type="password" name="userpassword">
52 + <!--type password시에 가려서 나옴-->
53 + </p>
54 + </fieldset>
55 + <fieldset>
56 + <legend>선택 입력 사항</legend>
57 + <p>
58 + <label for="datepicker">생년월일: </label>
59 + <input id="datepicker" type="date" name="userpassword">
60 +
61 + <!--달력은 크롬이나 파폭에서는 type 구현이 되어있는데 이번엔 jQuery 라이브러리로 활용해보자-->
62 + <!--라이브러리를 쓰면 어느 환경에서든 같은 달력을 있다. 기본을 쓰면 어느 브라우저는 나올 수도 있음-->
63 + </p>
64 + <p>
65 + <span>거주지를 선택해주세요.</span>
66 + <select name="user address"><!--미리 값이 있고 골라라 할때 사용-->
67 + <option value ="" disabled>거주지를 선택해주세요</option> <!-- 경우 선택이 안댐-->
68 + <option value="서울시">서울시</option>
69 + <option value="경기도">경기도</option>
70 + <option value="충청도">충청도</option>
71 + <option value="제주도">제주도</option>
72 + </select>
73 + </p>
74 + <p>
75 + <span>취미는</span>
76 + <label for="coding">코딩</label>
77 + <input id="coding" type="checkbox" name="userinterest">
78 +
79 + <label for="game">게임</label>
80 + <input id="game" type="checkbox" name="userinterest">
81 + <!--여기서 label input 연동을 안해두면 글씨를 클릭했을때는 체크가 되지 않는다.-->
82 + </p>
83 + <p>
84 + <span>성별</span>
85 + <label for="male">남성</label>
86 + <input id="male" type="radio" value = "남성" name ="sex">
87 +
88 + <label for="female">여성</label>
89 + <input id="female" type="radio" value = "여성" name ="sex">
90 + </p>
91 + <p>
92 + <span>기타 사항</span>
93 + <textarea name ="usermessage"></textarea><!--크기가 자율적임-->
94 + <textarea name ="usermessage" rows="10" cols="30"></textarea>
95 + <!-- <textarea>(이곳)<textarea> 엔터가 들어가면 공백이 들어가보임, 들어가면 안댐-->
96 + <!--만약 사이에 텍스트가 들어가면 스크롤로 자동 전환 된다.-->
97 + <textarea name ="contract" readonly ="readonly" rows="10" cols="30">아파치 하둡은 대량의 자료를 처리할 있는 컴퓨터 클러스터에서 동작하는 분산 응용 프로그램을 지원하는 프리웨어 자바 소프트웨어 프레임워크이다. 원래 너치의 분산 처리를 지원하기 위해 개발된 것으로, 아파치 루씬의 하부 프로젝트이다. 위키백과 작성 언어: 자바 최초 출시일: 2006 4 1 개발자: 아파치 소프트웨어 재단 라이선스: 아파치 라이선스 2.0 안정화 버전: 3.0.0 / 2017 12 13 종류: 분산 파일 시스템</textarea>
98 + <!--위의 readonly 옵션을 주면 수정 불가. 저렇게 value값이 같을 경우 readonly 생략가능-->
99 + </p>
100 +
101 + </fieldset>
102 + <input type="submit" value="회원 가입" /> <!-- 전송해주는 형태 + value -> 안에 들어갈 -->
103 + <input type="reset" value="재작성" />
104 + <input type="button" value="뒤로 가기" onclick="history.go(-1)"/>
105 + <!-- input value 있는 값이 나오고 button 가운뎃값이 나온다.-->
106 + <!--
107 + <hr/>
108 + <input class ="btn" type="image" src="send.png" alt="send"/>
109 + <button class ="btn" type="submit"><img src="send.png" alt="send"></button>-->
110 + <!-- input button 이미지를 넣는 방식 개의 이미지가 다르다. button 무조건
111 + 테두리(border, background) 생기는데 이때 필요없을 경우css에서 없애야 한다.-->
112 + </form>
113 + <!--<fieldset>
114 + <legend>CSS Test</legend>
115 + <p style="color: blue">Lorem ipsum dolor.</p>-->
116 + <!--Inline Style Sheet: 속성과 값만 들어감 꾸미는데 한계가 있고, 재사용 불가-->
117 + <!--Internal Style Sheet: <style>(여기)</style> 작성하는 방식
118 +
119 + <style>
120 + h1{
121 + color : blue;
122 +
123 + }
124 + </style>
125 + 이러면 문서 안의 h1의 모든 요소가 파란색 글자를 가지게 된다.
126 + 보통 <head></head>사시에 넣으나 html 문서의 어디에 넣어도 적용이 잘 되며, 이 방법은 html 문서 안의
127 + 여러 요소를 한번에 꾸밀 수 있다는 장점이 있으나, 또 다른 html 문서에는 적용할 수 없다는 단점이 있다.
128 + -->
129 + <!--Linking Style Sheet: 별도로 CSS 파일을 만들고 html 문서와 연결하는 방법이다. 예를 들어 h1 요소의 글자를
130 + 빨간색으로 하고 싶다면, 다음의; 내용으로 style.css 파일을 만든다
131 + style.css--------------
132 + | h1{ |
133 + | color: red; |
134 + | } |
135 + -----------------------.
136 +
137 +
138 + 이후 적용을 원하는 html 문서에
139 + <link rel="stylesheet" href="style.css">
140 + 코드를 추가한다. 경로는 html과 같이 있을 경우 위처럼 쓰고
141 + 문서가 있는 폴더에 css 폴더가 있고, 그 안에 style.css 파일이 있다면 다음과 같이 해야한다.
142 + <link rel="stylesheet" href="css/style.css">
143 + -->
144 + <!--</fieldset>-->
145 +</body>
146 +
147 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +
4 +<head>
5 + <meta charset="utf-8">
6 + <title>회원가입</title>
7 + <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
8 + <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
9 + <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
10 + <script>
11 + $(function () {
12 + $("#datepicker").datepicker();
13 + //여기 #은 id인데 <p>Date: <input type="text" id="datepicker"></p> 이렇게 넣을때
14 + //type은 text id를 datepicker로 사용
15 + });
16 + </script>
17 + <style>
18 + .ui-widget-header {background:navy; color:#fff;}
19 + .btn{width: 100px; height:50px; background: none; border:none; padding:0;}
20 + /*크기 설정 해주고 background, border, padding을 none, 0으로 초기화*/
21 + button img{width:90%;}/*부모(button)가 할당해준 값에서 최대치를 사용하도록 설정해서 button도 설정이 들어가게*/
22 + </style>
23 +</head>
24 +
25 +<body>
26 + <form action="#" method="POST">
27 + <!-- 전송될 무언가는 반드시 form으로 감싸져야한다.,
28 + 이게 어디로 전송될지 action 다음 스크립트 파일을 적어주면 된다.-->
29 + <!--서버에 어떻게 전송할지에 대한 방법이 적혀야함(method) form옆에는 반드시 따라붙음 -->
30 + <!-- post = 암호화, get 암호화x 주소표시줄에 같이 표시되서 묻어간다.-->
31 + <!-- 개발자 도구에서 확인해보면 옆에 메소드가 붙어있음 회원가입은 암호화해야하니까 post-->
32 + <fieldset>
33 + <!--필드셋으로 묶고 legend 라벨링-->
34 + <legend>필수 입력 사항</legend>
35 + <p>
36 + <label for="name">이름: </label>
37 + <input id="name" type="text" name="username">
38 + <!--name 데이터베이스의 필드(애트리뷰트)명이다.-->
39 + <!-- 경우 프로그래머끼리 협의를 보거나 백앤드 작업자를 위해 비워두고 커스텀하게 한다.-->
40 + </p>
41 + <!--패러그래프: tab 역할을 한다.-->
42 + <p>
43 + <label for="email">이메일: </label>
44 + <input id="email" type="email" name="useremail">
45 + <!--input(사용자 입력 가능칸) label 붙어 있어야 한다 이때 적절한 id 주자 id==for 매치-->
46 + <!-- input에는 type 있는데 type 설정해서 우리가 원하는 형태로 데이터를 받을 있음 -->
47 + <!-- email type 걸면 브라우저가 이메일 형식 이외의 것을 차단함-->
48 + </p>
49 + <p>
50 + <label for="password">비밀번호: </label>
51 + <input id="password" type="password" name="userpassword">
52 + <!--type password시에 가려서 나옴-->
53 + </p>
54 + </fieldset>
55 + <fieldset>
56 + <legend>선택 입력 사항</legend>
57 + <p>
58 + <label for="datepicker">생년월일: </label>
59 + <input id="datepicker" type="date" name="userpassword">
60 +
61 + <!--달력은 크롬이나 파폭에서는 type 구현이 되어있는데 이번엔 jQuery 라이브러리로 활용해보자-->
62 + <!--라이브러리를 쓰면 어느 환경에서든 같은 달력을 있다. 기본을 쓰면 어느 브라우저는 나올 수도 있음-->
63 + </p>
64 + <p>
65 + <span>거주지를 선택해주세요.</span>
66 + <select name="user address"><!--미리 값이 있고 골라라 할때 사용-->
67 + <option value ="" disabled>거주지를 선택해주세요</option> <!-- 경우 선택이 안댐-->
68 + <option value="서울시">서울시</option>
69 + <option value="경기도">경기도</option>
70 + <option value="충청도">충청도</option>
71 + <option value="제주도">제주도</option>
72 + </select>
73 + </p>
74 + <p>
75 + <span>취미는</span>
76 + <label for="coding">코딩</label>
77 + <input id="coding" type="checkbox" name="userinterest">
78 +
79 + <label for="game">게임</label>
80 + <input id="game" type="checkbox" name="userinterest">
81 + <!--여기서 label input 연동을 안해두면 글씨를 클릭했을때는 체크가 되지 않는다.-->
82 + </p>
83 + <p>
84 + <span>성별</span>
85 + <label for="male">남성</label>
86 + <input id="male" type="radio" value = "남성" name ="sex">
87 +
88 + <label for="female">여성</label>
89 + <input id="female" type="radio" value = "여성" name ="sex">
90 + </p>
91 + <p>
92 + <span>기타 사항</span>
93 + <textarea name ="usermessage"></textarea><!--크기가 자율적임-->
94 + <textarea name ="usermessage" rows="10" cols="30"></textarea>
95 + <!-- <textarea>(이곳)<textarea> 엔터가 들어가면 공백이 들어가보임, 들어가면 안댐-->
96 + <!--만약 사이에 텍스트가 들어가면 스크롤로 자동 전환 된다.-->
97 + <textarea name ="contract" readonly ="readonly" rows="10" cols="30">아파치 하둡은 대량의 자료를 처리할 있는 컴퓨터 클러스터에서 동작하는 분산 응용 프로그램을 지원하는 프리웨어 자바 소프트웨어 프레임워크이다. 원래 너치의 분산 처리를 지원하기 위해 개발된 것으로, 아파치 루씬의 하부 프로젝트이다. 위키백과 작성 언어: 자바 최초 출시일: 2006 4 1 개발자: 아파치 소프트웨어 재단 라이선스: 아파치 라이선스 2.0 안정화 버전: 3.0.0 / 2017 12 13 종류: 분산 파일 시스템</textarea>
98 + <!--위의 readonly 옵션을 주면 수정 불가. 저렇게 value값이 같을 경우 readonly 생략가능-->
99 + </p>
100 +
101 + </fieldset>
102 + <input type="submit" value="회원 가입" /> <!-- 전송해주는 형태 + value -> 안에 들어갈 -->
103 + <input type="reset" value="재작성" />
104 + <input type="button" value="뒤로 가기" onclick="history.go(-1)"/>
105 + <!-- input value 있는 값이 나오고 button 가운뎃값이 나온다.-->
106 + <!--
107 + <hr/>
108 + <input class ="btn" type="image" src="send.png" alt="send"/>
109 + <button class ="btn" type="submit"><img src="send.png" alt="send"></button>-->
110 + <!-- input button 이미지를 넣는 방식 개의 이미지가 다르다. button 무조건
111 + 테두리(border, background) 생기는데 이때 필요없을 경우css에서 없애야 한다.-->
112 + </form>
113 + <!--<fieldset>
114 + <legend>CSS Test</legend>
115 + <p style="color: blue">Lorem ipsum dolor.</p>-->
116 + <!--Inline Style Sheet: 속성과 값만 들어감 꾸미는데 한계가 있고, 재사용 불가-->
117 + <!--Internal Style Sheet: <style>(여기)</style> 작성하는 방식
118 +
119 + <style>
120 + h1{
121 + color : blue;
122 +
123 + }
124 + </style>
125 + 이러면 문서 안의 h1의 모든 요소가 파란색 글자를 가지게 된다.
126 + 보통 <head></head>사시에 넣으나 html 문서의 어디에 넣어도 적용이 잘 되며, 이 방법은 html 문서 안의
127 + 여러 요소를 한번에 꾸밀 수 있다는 장점이 있으나, 또 다른 html 문서에는 적용할 수 없다는 단점이 있다.
128 + -->
129 + <!--Linking Style Sheet: 별도로 CSS 파일을 만들고 html 문서와 연결하는 방법이다. 예를 들어 h1 요소의 글자를
130 + 빨간색으로 하고 싶다면, 다음의; 내용으로 style.css 파일을 만든다
131 + style.css--------------
132 + | h1{ |
133 + | color: red; |
134 + | } |
135 + -----------------------.
136 +
137 +
138 + 이후 적용을 원하는 html 문서에
139 + <link rel="stylesheet" href="style.css">
140 + 코드를 추가한다. 경로는 html과 같이 있을 경우 위처럼 쓰고
141 + 문서가 있는 폴더에 css 폴더가 있고, 그 안에 style.css 파일이 있다면 다음과 같이 해야한다.
142 + <link rel="stylesheet" href="css/style.css">
143 + -->
144 + <!--</fieldset>-->
145 +</body>
146 +
147 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +
4 +<head>
5 + <style type="text/css">
6 + * {
7 + box-sizing: border-box;
8 + margin: 0;
9 + padding: 0;
10 +
11 + }
12 +
13 + body {
14 + font-family: "맑은 고딕";
15 + font-size: 0.75em;
16 + color: #333;
17 +
18 + }
19 +
20 + #login-form {
21 + width: 250px;
22 + margin: 100px auto;
23 + border: 10px solid skyblue;
24 + border-radius: 5px;
25 + padding: 15px;
26 + }
27 +
28 + #login-form label {
29 + display: block;
30 + }
31 +
32 + #login-form label {
33 + margin-top: 10px;
34 + }
35 +
36 + #login-form input {
37 + margin-top: 5px;
38 + }
39 +
40 +
41 + /* 애트리뷰트 선택자 */
42 + #login-form input[type='image'] {
43 + margin: 0px auto;
44 + width: 90px;
45 + height: 40px;
46 + }
47 + #login-form input[type='button'] {
48 + background: url( "images/join.png" ) no-repeat;
49 + background-position: center center;
50 + background-size: contain;
51 + border: none;
52 + width: 90px;
53 + height: 50px;
54 + }
55 +
56 + </style>
57 +
58 +
59 +</head>
60 +
61 +<body>
62 + <form id="login-form" action="#" method="POST">
63 +
64 + <label class="Legend" for="id">아이디</label>
65 + <input id="id" type="text" maxlength="20" name="userid" />
66 +
67 + <label class="Legend" for="password">패스워드</label>
68 + <input id="password" type="password" maxlength="20" name="userpassword"/>
69 + </br></br>
70 +
71 + <input type="image" src="images/login_btn.png" value="로그인">
72 + <input type="button" onclick="location.href='join.html'"/>
73 +
74 + </form>
75 +</body>
76 +
77 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +
4 +<head>
5 + <meta charset="utf-8">
6 + <title>회원가입</title>
7 + <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
8 + <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
9 + <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
10 + <script>
11 + $(function () {
12 + $("#datepicker").datepicker();
13 + });
14 + </script>
15 + <style>
16 + body{
17 + background: #34495e;
18 + margin: 0;
19 + }
20 + .box{
21 + width: 300px;
22 + padding: 40px;
23 + position: absolute;
24 + top: 50%;
25 + left: 50%;
26 + transform: translate(-50%,-50%);
27 + background: #191919;
28 + text-align: center;
29 + }
30 + .box h1{
31 + color: white;
32 + text-transform: uppercase;
33 + font-weight: 500;
34 + }
35 + .box input[type="text"],.box input[type="password"], .box input[type="email"]{
36 + border:0;
37 + background: none;
38 + margin: 20px auto;
39 + text-align: center;
40 + border: 2px solid #3498db;
41 + padding: 14px 10px;
42 + width: 200px;
43 + outline: none;
44 + color: white;
45 + border-radius: 24px;
46 + transition: 0.25s;
47 + cursor: pointer;
48 + }
49 + .box input[type="text"]:focus,.box input[type="password"]:focus, .box input[type="email"]:focus{
50 + width: 280px;
51 + border-color:#2ecc71;
52 +
53 + }
54 + .box input[type="submit"]:hover, .box input[type="button"]:hover, .box input[type="reset"]:hover{
55 + background:#2ecc71;
56 + }
57 +
58 + .ui-widget-header {background:navy; color:#fff;}
59 + input[class="btn"]{
60 + border: none;
61 + color: white;
62 + font-family: NanumSquareWeb;
63 + font-size: large;
64 + font-weight: bold;
65 + text-align: center;
66 + border-radius: 20px;
67 + width: 32%;
68 + height: 40px;
69 + float: left;
70 + }
71 + input[id="submit"]{
72 + background-color: #191919;
73 + border: 2px solid #3498db;
74 + }
75 + input[id="reset"]{
76 + background-color: #191919;
77 + border: 2px solid #3498db;
78 + }
79 + input[id="back"]{
80 + background-color: #191919;
81 + border: 2px solid #3498db;
82 + }
83 + button img{width:90%;}
84 + @media(max-width: 577px ){
85 + input[class='btn'] {
86 + width: 100%;
87 + }
88 + }
89 + </style>
90 +</head>
91 +
92 +<body>
93 + <form class="box" action="#" method="POST">
94 + <h1>필수 입력 사항</h1>
95 + <p>
96 + <input id="name" type="text" name="username" placeholder="Name">
97 + </p>
98 + <p>
99 + <input id="password" type="password" name="userpassword" placeholder="Password">
100 + </p>
101 + <p>
102 + <input id="email" type="email" name="useremail" placeholder="Email">
103 + </p>
104 +
105 + <input class="btn" id="submit" type="submit" background-color="" value="회원 가입" /> <!-- 전송해주는 형태 + value -> 안에 들어갈 값-->
106 + <input class="btn" id="reset" type="reset" value="재작성" />
107 + <input class="btn" id="back" type="button" value="뒤로 가기" onclick="history.go(-1)"/>
108 + </form>
109 +</body>
110 +
111 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +
4 +<head>
5 + <meta charset="utf-8">
6 + <meta name="viewport" content="width=device-width,initial-scale=1" />
7 + <style type="text/css">
8 + * {
9 + box-sizing: border-box;
10 + margin: 0;
11 + padding: 0;
12 + }
13 + /*모든 element에 적용되는 것 */
14 +
15 +
16 + @font-face {
17 + font-family: NanumSquareWeb;
18 + src: local(NanumSquareR),
19 + local(NanumSquare),
20 + url(NanumSquareR.eot?#iefix) format('embedded-opentype'),
21 + url(NanumSquareR.woff) format('woff'),
22 + url(NanumSquareR.ttf) format('truetype');
23 + font-style: normal;
24 + font-weight: normal;
25 + unicode-range: U+0-10FFFF;
26 + }
27 +
28 + h1 {
29 + font-family: NanumSquareWeb, sans-serif;
30 + }
31 +
32 + body {
33 + font-family: "맑은 고딕";
34 + font-size: 0.75em;
35 + color: #333;
36 +
37 + }
38 +
39 + #login-form {
40 + width: 250px;
41 + height: 250px;
42 + margin: 100px auto;
43 + border: 10px solid skyblue;
44 + border-radius: 5px;
45 + padding: 15px;
46 + }
47 +
48 + #login-form label {
49 + display: block;
50 + }
51 +
52 + #login-form label {
53 + margin-top: 10px;
54 + }
55 +
56 + #login-form input {
57 + margin-top: 5px;
58 + }
59 +
60 +
61 + /* 애트리뷰트 선택자 */
62 + #login-form input[type='image'] {
63 + margin: 0px auto;
64 + background-size: cover;
65 + width: 90px;
66 + height: 40px;
67 + }
68 +
69 + #login-form input[id='Lbutton'] {
70 + background-color: orange;
71 + border: none;
72 + color: white;
73 + font-family: NanumSquareWeb;
74 + font-size: large;
75 + font-weight: bold;
76 + text-align: center;
77 + border-radius: 20px;
78 + width: 100%;
79 + height: 40px;
80 + float: left;
81 + }
82 +
83 + #login-form input[id='Jbutton'] {
84 + background-color: red;
85 + font-size: large;
86 + font-weight: bold;
87 + text-align: center;
88 + font-family: NanumSquareWeb;
89 + border-radius: 20px;
90 + border: none;
91 + color: white;
92 + width: 100%;
93 + height: 40px;
94 + float: left;
95 + }
96 +
97 + @media(min-width: 577px ){
98 + #login-form {
99 + height: 200px;
100 + }
101 + #login-form input[id='Jbutton'] {
102 + width: 50%;
103 + }
104 + #login-form input[id='Lbutton'] {
105 + width: 50%;
106 + }
107 + }
108 + </style>
109 +</head>
110 +
111 +<body>
112 + <form id="login-form" action="#" method="POST">
113 + <label class="Legend" for="id">아이디</label>
114 + <input id="id" type="text" maxlength="20" name="userid" />
115 +
116 + <label class="Legend" for="password">패스워드</label>
117 + <input id="password" type="password" maxlength="20" name="userpassword" />
118 + </br></br>
119 +
120 + <div class="btn">
121 + <input id="Lbutton" type="button" name="login" value="Login">
122 + <input id="Jbutton" type="button" name="join" onclick="location.href='join.html'" value="Join">
123 + </div>
124 +
125 +
126 + </form>
127 +</body>
128 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +
4 +<head>
5 + <meta charset="utf-8">
6 + <title>회원가입</title>
7 + <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
8 + <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
9 + <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
10 + <script>
11 + $(function () {
12 + $("#datepicker").datepicker();
13 + });
14 + </script>
15 +
16 + <style>
17 + body {
18 + background: #34495e;
19 + margin: 0;
20 + }
21 +
22 + .box {
23 + width: 300px;
24 + padding: 40px;
25 + position: absolute;
26 + top: 50%;
27 + left: 50%;
28 + transform: translate(-50%, -50%);
29 + background: #191919;
30 + text-align: center;
31 + }
32 +
33 + .box h1 {
34 + color: white;
35 + text-transform: uppercase;
36 + font-weight: 500;
37 + }
38 +
39 + .box input[type="text"],
40 + .box input[type="password"],
41 + .box input[type="email"] {
42 + border: 0;
43 + background: none;
44 + margin: 20px auto;
45 + text-align: center;
46 + border: 2px solid #3498db;
47 + padding: 14px 10px;
48 + width: 200px;
49 + outline: none;
50 + color: white;
51 + border-radius: 24px;
52 + transition: 0.25s;
53 + cursor: pointer;
54 + }
55 +
56 + .box input[type="text"]:focus,
57 + .box input[type="password"]:focus,
58 + .box input[type="email"]:focus {
59 + width: 280px;
60 + border-color: #2ecc71;
61 +
62 + }
63 +
64 + .box input[type="submit"]:hover,
65 + .box input[type="button"]:hover,
66 + .box input[type="reset"]:hover {
67 + background: #2ecc71;
68 + }
69 +
70 + .ui-widget-header {
71 + background: navy;
72 + color: #fff;
73 + }
74 +
75 + input[class="btn"] {
76 + border: none;
77 + color: white;
78 + font-family: NanumSquareWeb;
79 + font-size: large;
80 + font-weight: bold;
81 + text-align: center;
82 + border-radius: 20px;
83 + width: 32%;
84 + height: 40px;
85 + float: left;
86 + }
87 +
88 + input[id="submit"] {
89 + background-color: #191919;
90 + border: 2px solid #3498db;
91 + }
92 +
93 + input[id="reset"] {
94 + background-color: #191919;
95 + border: 2px solid #3498db;
96 + }
97 +
98 + input[id="back"] {
99 + background-color: #191919;
100 + border: 2px solid #3498db;
101 + }
102 +
103 + button img {
104 + width: 90%;
105 + }
106 +
107 + @media(max-width: 577px) {
108 + input[class='btn'] {
109 + width: 100%;
110 + }
111 + }
112 + </style>
113 + <span id="alert-success" style="display: none;">비밀번호가 일치합니다.</span>
114 + <span id="alert-danger" style="display: none; color: #ffffff; font-weight: bold; ">비밀번호가 일치하지 않습니다.</span>
115 +</head>
116 +<body>
117 + <form class="box" action="#" method="POST" onsubmit="return checkAll(this)">
118 + <h1>필수 입력 사항</h1>
119 + <input id="id" type="text" name="userid" placeholder="ID" required>
120 +
121 + <input id="name" type="text" name="username" placeholder="Name" required>
122 +
123 + <input class="pw" id="password" type="password" name="userpassword" placeholder="Password" required>
124 +
125 + <input class="pw" id="password_check" type="password" name="userpassword_check" placeholder="Password Check" required>
126 +
127 + <input id="email" type="email" name="useremail" placeholder="Email" required>
128 +
129 + <input class="btn" id="submit" type="submit" background-color="" value="회원 가입" />
130 + <!-- 전송해주는 형태 + value -> 안에 들어갈 값-->
131 + <input class="btn" id="reset" type="reset" value="재작성" />
132 + <input class="btn" id="back" type="button" value="뒤로 가기" onclick="history.go(-1)" />
133 + </form>
134 + <script language="javascript">
135 + function checkAll(form) {
136 + if (!checkUserId(form.userid.value)) {
137 + return false;
138 + }
139 + if (!checkPassword(form.userid.value, form.userpassword.value, form.userpassword_check.value)) {
140 + return false;
141 + }
142 + if (!checkMail(form.useremail.value)) {
143 + return false;
144 + }
145 + return true;
146 + }
147 +
148 +
149 + function checkUserId(id) {
150 + //함수 매개변수로 넘어오는 값은 input 태그에 들어가는 값.
151 + //Id가 입력되었는지 확인하기
152 + if (!checkExistData(id, "아이디를"))
153 + return false;
154 +
155 + var idRegExp = /^[a-zA-z0-9]{5,15}$/; //아이디 유효성 검사
156 + if (!idRegExp.test(id)) {
157 + alert("아이디는 영문 대소문자와 숫자 5~15자리로 입력해야합니다!");
158 + form.userid.value = "";
159 + document.getElementById(userid).focus();
160 + return false;
161 + }
162 + return true; //확인이 완료되었을 때
163 + }
164 +
165 + function checkPassword(id, password1, password2) {
166 + //비밀번호가 입력되었는지 확인하기
167 + if (!checkExistData(password1, "비밀번호를"))
168 + return false;
169 + //비밀번호 확인이 입력되었는지 확인하기
170 + if (!checkExistData(password2, "비밀번호 확인을"))
171 + return false;
172 +
173 + var swit = new Boolean(true);
174 +
175 + var password1RegExp = /^[a-zA-z0-9]{4,12}$/; //비밀번호 유효성 검사
176 + if (!password1RegExp.test(password1)) {
177 + alert("비밀번호는 영문 대소문자와 숫자 4~12자리로 입력해야합니다!");
178 + document.getElementById(userpassword).focus();
179 + swit = false;
180 + }
181 + //비밀번호와 비밀번호 확인이 맞지 않다면..
182 + if (password1 != password2) {
183 + alert("두 비밀번호가 맞지 않습니다.");
184 + document.getElementById(userpassword_check).focus();
185 + swit = false;
186 + }
187 +
188 + //아이디와 비밀번호가 같을 때..
189 + if (id == password1) {
190 + alert("아이디와 비밀번호는 같을 수 없습니다!");
191 + document.getElementById(userid).focus();
192 + document.getElementById(userpassword).focus();
193 + swit = false;
194 + }
195 +
196 + if(swit)
197 + {
198 + return true;
199 + }
200 + else{
201 + form.userpassword.value = "";
202 + form.userpassword_check.value = "";
203 + return false;
204 + }
205 + }
206 +
207 + function checkMail(email) {
208 + //mail이 입력되었는지 확인하기
209 + if (!checkExistData(mail, "이메일을"))
210 + return false;
211 +
212 + var emailRegExp = /^[A-Za-z0-9_]+[A-Za-z0-9]*[@]{1}[A-Za-z0-9]+[A-Za-z0-9]*[.]{1}[A-Za-z]{1,3}$/;
213 + if (!emailRegExp.test(mail)) {
214 + alert("이메일 형식이 올바르지 않습니다!");
215 + form.useremail.value = "";
216 + document.getElementById(useremail).focus();
217 + return false;
218 + }
219 + return true; //확인이 완료되었을 때
220 + }
221 +
222 + // 공백확인 함수
223 + function checkExistData(value, dataName) {
224 + if (value == "") {
225 + alert(dataName + " 입력해주세요!");
226 + return false;
227 + }
228 + return true;
229 + }
230 + </script>
231 +</body>
232 +
233 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +
4 +<head>
5 + <meta charset="utf-8">
6 + <title>회원가입</title>
7 + <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
8 + <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
9 + <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
10 + <script>
11 + $(function () {
12 + $("#datepicker").datepicker();
13 + });
14 + </script>
15 +
16 + <style>
17 + body {
18 + background: #34495e;
19 + margin: 0;
20 + }
21 +
22 + .box {
23 + width: 300px;
24 + padding: 40px;
25 + position: absolute;
26 + top: 50%;
27 + left: 50%;
28 + transform: translate(-50%, -50%);
29 + background: #191919;
30 + text-align: center;
31 + }
32 +
33 + .box h1 {
34 + color: white;
35 + text-transform: uppercase;
36 + font-weight: 500;
37 + }
38 +
39 + .box input[type="text"],
40 + .box input[type="password"],
41 + .box input[type="email"] {
42 + border: 0;
43 + background: none;
44 + margin: 20px auto;
45 + text-align: center;
46 + border: 2px solid #3498db;
47 + padding: 14px 10px;
48 + width: 200px;
49 + outline: none;
50 + color: white;
51 + border-radius: 24px;
52 + transition: 0.25s;
53 + cursor: pointer;
54 + }
55 +
56 + .box input[type="text"]:focus,
57 + .box input[type="password"]:focus,
58 + .box input[type="email"]:focus {
59 + width: 280px;
60 + border-color: #2ecc71;
61 +
62 + }
63 +
64 + .box input[type="submit"]:hover,
65 + .box input[type="button"]:hover,
66 + .box input[type="reset"]:hover {
67 + background: #2ecc71;
68 + }
69 +
70 + .ui-widget-header {
71 + background: navy;
72 + color: #fff;
73 + }
74 +
75 + input[class="btn"] {
76 + border: none;
77 + color: white;
78 + font-family: NanumSquareWeb;
79 + font-size: large;
80 + font-weight: bold;
81 + text-align: center;
82 + border-radius: 20px;
83 + width: 32%;
84 + height: 40px;
85 + float: left;
86 + }
87 +
88 + input[id="submit"] {
89 + background-color: #191919;
90 + border: 2px solid #3498db;
91 + }
92 +
93 + input[id="reset"] {
94 + background-color: #191919;
95 + border: 2px solid #3498db;
96 + }
97 +
98 + input[id="back"] {
99 + background-color: #191919;
100 + border: 2px solid #3498db;
101 + }
102 +
103 + button img {
104 + width: 90%;
105 + }
106 +
107 + @media(max-width: 577px) {
108 + input[class='btn'] {
109 + width: 100%;
110 + }
111 + }
112 + </style>
113 + <span id="alert-success" style="display: none;">비밀번호가 일치합니다.</span>
114 + <span id="alert-danger" style="display: none; color: #ffffff; font-weight: bold; ">비밀번호가 일치하지 않습니다.</span>
115 +</head>
116 +
117 +<body>
118 + <form class="box" action="#" method="POST">
119 + <div class="Join_form">
120 + <h1>필수 입력 사항</h1>
121 + <div class="div_id" id="div_id">
122 + <input id="id" class="id" type="text" name="userid" placeholder="ID" required>
123 + <div class="div_id_text" id="div_id_text"></div>
124 + </div>
125 +
126 + <div class="div_name" id="div_name">
127 +
128 + <input id="name" type="text" name="username" placeholder="Name" required>
129 + </div>
130 + <div class="div_pw" id="div_pw">
131 + <input class="pw1" id="password" type="password" name="userpassword" placeholder="Password" required>
132 + <div class="div_pw_text" id="div_pw_text"></div>
133 + </div>
134 + <div class="div_check" id="div_check">
135 + <input class="pw2" id="password_check" type="password" name="userpassword_check"
136 + placeholder="Password Check" required>
137 + <div class="div_check_text" id="div_check_text"></div>
138 + </div>
139 + <div class="div_email" id="div_email">
140 +
141 + <input id="email" class="mail" type="email" name="useremail" placeholder="Email" required>
142 + <div class="div_email_text" id="div_email_text"></div>
143 + </div>
144 + <div class="div_btn">
145 + <input class="btn" id="submit" type="submit" background-color="" value="회원 가입" />
146 + <!-- 전송해주는 형태 + value -> 안에 들어갈 값-->
147 + <input class="btn" id="reset" type="reset" value="재작성" />
148 + <input class="btn" id="back" type="button" value="뒤로 가기" onclick="history.go(-1)" />
149 +
150 + </div>
151 +
152 + </div>
153 +
154 + </form>
155 + <script>
156 +
157 + var email = $('.mail');
158 + var id = $('.id');
159 + var password = $('.pw1');
160 + var password_check = $('.pw2');
161 +
162 + var idRegExp = /^[a-zA-z0-9]{5,15}$/; //아이디 유효성 검사
163 + var emailRegExp = /^[A-Za-z0-9_]+[A-Za-z0-9]*[@]{1}[A-Za-z0-9]+[A-Za-z0-9]*[.]{1}[A-Za-z]{1,3}$/;
164 +
165 + email.blur(function () {
166 + if (!emailRegExp.test(email.val())) {
167 + $("input[name='useremail']").css('border-color', '#ff0000');
168 + $("input[name='useremail']").focus();
169 + }
170 + else {
171 + setTimeout(function () { $("input[name='useremail']").css('border-color', '#3498db'); }, 500);
172 + }
173 + });
174 + id.blur(function () {
175 + if (!idRegExp.test(id.val())) {
176 + $("#div_id_text").text("아이디는 5~15자의 영숫자로 만들어주세요.");
177 + $("#div_id_text").css('color', 'red');
178 + $("#div_id_text").css('font-size', '1.5vw');
179 + }
180 + else {
181 + $("#div_id_text").text("");
182 + }
183 + });
184 + password_check.blur(function () {
185 + if (password.val() != '' && password_check.val() != '') {
186 + if (password.val() != password_check.val()) {
187 + $("#div_pw_text").text("비밀번호가 일치하지 않습니다.");
188 + $("#div_pw_text").css('color', 'red');
189 + $("#div_pw_text").css('font-size', '1.5vw');
190 + $("#div_check_text").text("비밀번호가 일치하지 않습니다.");
191 + $("#div_check_text").css('color', 'red');
192 + $("#div_check_text").css('font-size', '1.5vw');
193 + $("input[name='userpassword']").css('border-color', '#ff0000');
194 + $("input[name='userpassword_check']").css('border-color', '#ff0000');
195 +
196 + }
197 + else {
198 + $("#div_pw_text").text('');
199 + $("#div_check_text").text('');
200 + setTimeout(function () { $("input[name='userpassword']").css('border-color', '#3498db'); }, 500);
201 + setTimeout(function () { $("input[name='userpassword_check']").css('border-color', '#3498db'); }, 500);
202 +
203 + }
204 + }
205 + });
206 + password.blur(function () {
207 + if (password.val() != '' && password_check.val() != '') {
208 + if (password.val() != password_check.val()) {
209 + $("#div_pw_text").text("비밀번호가 일치하지 않습니다.");
210 + $("#div_pw_text").css('color', 'red');
211 + $("#div_pw_text").css('font-size', '1.5vw');
212 + $("#div_check_text").text("비밀번호가 일치하지 않습니다.");
213 + $("#div_check_text").css('color', 'red');
214 + $("#div_check_text").css('font-size', '1.5vw');
215 + $("input[name='userpassword']").css('border-color', '#ff0000');
216 + $("input[name='userpassword_check']").css('border-color', '#ff0000');
217 +
218 +
219 + }
220 + else {
221 + $("#div_pw_text").text('');
222 + $("#div_check_text").text('');
223 + setTimeout(function () { $("input[name='userpassword']").css('border-color', '#3498db'); }, 500);
224 + setTimeout(function () { $("input[name='userpassword_check']").css('border-color', '#3498db'); }, 500);
225 +
226 + }
227 + }
228 + });
229 + </script>
230 +</body>
231 +
232 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +# Default ignored files
2 +/shelf/
3 +/workspace.xml
4 +# Datasource local storage ignored files
5 +/dataSources/
6 +/dataSources.local.xml
7 +# Editor-based HTTP Client requests
8 +/httpRequests/
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<module type="JAVA_MODULE" version="4">
3 + <component name="NewModuleRootManager" inherit-compiler-output="true">
4 + <exclude-output />
5 + <content url="file://$MODULE_DIR$" />
6 + <orderEntry type="inheritedJdk" />
7 + <orderEntry type="sourceFolder" forTests="false" />
8 + </component>
9 +</module>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="JavaScriptLibraryMappings">
4 + <file url="file://$PROJECT_DIR$" libraries="{Node.js Core}" />
5 + </component>
6 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="JavaScriptSettings">
4 + <option name="languageLevel" value="ES6" />
5 + </component>
6 + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
7 + <output url="file://$PROJECT_DIR$/out" />
8 + </component>
9 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="ProjectModuleManager">
4 + <modules>
5 + <module fileurl="file://$PROJECT_DIR$/.idea/df.iml" filepath="$PROJECT_DIR$/.idea/df.iml" />
6 + </modules>
7 + </component>
8 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +const axios = require('axios');
2 +const mysql = require('mysql2');
3 +
4 +const connection = mysql.createConnection({
5 + host: 'localhost',
6 + port: '3307',
7 + user: 'root',
8 + password: 'yj',
9 + database: 'projectdf',
10 +}).promise();
11 +
12 +const GetItem = async (filter, page) => {
13 + // filter = 에픽(204), 신화(207)
14 + const response = await axios({
15 + method: 'post',
16 + url: 'http://df.nexon.com/FRM/info/equipment_search_api.php',
17 + headers: {
18 + 'Accept': 'application/json, text/javascript, */*; q=0.01',
19 + 'X-Requested-With': 'XMLHttpRequest',
20 + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
21 + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
22 + 'Referer': 'http://df.nexon.com/df/info/equipment/search?page=1&is_limit=&filter=207&max=100&min=100&level=Y&order_name=level&order_type=asc',
23 + },
24 + data: `mode=search&data[keyword]=&data[filter]=${filter}&data[level]=Y&data[min]=100&data[max]=100&data[setitem]=N&data[order_name]=level&data[order_type]=asc&page=${page}`,
25 + });
26 + return response.data.data.items;
27 +};
28 +
29 +(async () => {
30 +
31 + const ex = /.운디네|.샐러맨더|.실프|포용의|맹렬히|휘감는|잔잔한|신록의 숨결|에너지 분배 제어기|전자기 진공관|제어 회로|무의식 : .|무형 : .|환영 : .|원초의 꿈.|진 :.|.결투장|퍼펙트 컨트롤|불타오르는 푸른 마력|암살자의 비수|마더 오브 네이쳐|거미 여왕의 목소리|풀 가드 네클레스|선지자의 목걸이|생멸 관장자의 팔찌|독을 머금은 가시장갑|할기의 링|올 엘리멘탈 크리스탈|웨슬리의 전술지휘봉|볼 오브 러데이니언|금지된 계약의 서|응축된 마력의 소용돌이|청면수라의 가면|얼어붙은 숨결의 결정|뒤틀린 이계의 마석|영광의 보석|적귀의 차원석|패스트퓨처 이어링|무념의 의식|무의식의 꽃|무형의 절개|무언의 죄악|무아의 고리/ig;
32 + const filter_list = ['204', '207'];
33 + for (const filter of filter_list) {
34 + let page = 1;
35 + while (true) {
36 + const data = await GetItem(filter, page);
37 + for (const item of data) {
38 + try {
39 + if (item.name.match(ex) == null) {
40 + await connection.query('INSERT INTO `item_exception` SET ?', {
41 + itemId: item.itemId,
42 + name: item.name,
43 + type: (filter === '204') ? 'epic' : 'myth',
44 + });
45 + }
46 + } catch (e) {}
47 + }
48 + if (data.length === 0) {
49 + break;
50 + }
51 + page++;
52 + }
53 + }
54 + await connection.close();
55 +})();
1 +const axios = require('axios');
2 +const crypto = require('crypto');
3 +const mysql = require('mysql2');
4 +const moment = require('moment');
5 +const cron = require('node-cron');
6 +const scheduler = require('node-schedule');
7 +
8 +var now = new Date();
9 +require('moment-timezone');
10 +moment.tz.setDefault("Asia/Seoul");
11 +
12 + const connection = mysql.createConnection({
13 + host: 'localhost',
14 + port: '3307',
15 + user: 'root',
16 + password: 'yj',
17 + database: 'projectdf',
18 + }).promise();
19 + const GetItemDrop = async (itemId) => {
20 + const response = await axios({
21 + method: 'post',
22 + url: `http://df.nexon.com/FRM/game/epic_drop.php?id=${itemId}`,
23 + headers: {
24 + 'Accept': 'application/json, text/javascript, */*; q=0.01',
25 + 'X-Requested-With': 'XMLHttpRequest',
26 + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
27 + 'Referer': `http://df.nexon.com/df/info/equipment/view?id=${itemId}&page=3&is_limit=&filter=204&max=100&min=100&level=Y&order_name=level&order_type=asc`,
28 + },
29 + });
30 + return response.data;
31 + };
32 +
33 +
34 +let job = scheduler.scheduleJob('*/15 * * * * *',function(){
35 +
36 + var dateT = moment().format('YYYY-MM-DD HH:mm:ss');
37 + console.log("Start "+dateT);
38 + (async () => {
39 + const [item_list] = await connection.query('SELECT * FROM `item_exception`');
40 + for (const item of item_list) {
41 + const data = await GetItemDrop(item.itemId);
42 + for (const drop of data) {
43 + const input = {
44 + itemId: drop.item_no,
45 + channel_name: drop.channel_name,
46 + channel_number: drop.channel_number,
47 + dungeon: drop.dungeon,
48 + droped_at: moment.unix(drop.time).format('YYYY-MM-DD HH:mm:ss'),
49 + };
50 + input['hash'] = crypto.createHash('md5').update(JSON.stringify(input)).digest('hex');
51 + try {
52 + await connection.query('INSERT INTO `item_drop_exception` SET ?', input);
53 + } catch (e) {}
54 + }
55 + }
56 + var dateT2 = moment().format('YYYY-MM-DD HH:mm:ss');
57 + console.log(dateT+" insert DB Done in" + dateT2);
58 + })();
59 +});
60 +// await connection.close();-> 크론 작업을 돌리기 때문에 제외
61 +
62 +
63 +// cron.schedule('*/15 * * * * *', function () {
64 +
65 +// var dateT = moment().format('YYYY-MM-DD HH:mm:ss');
66 +// console.log("Start "+dateT);
67 +// const connection = mysql.createConnection({
68 +// host: 'localhost',
69 +// port: '3307',
70 +// user: 'root',
71 +// password: 'yj',
72 +// database: 'projectdf',
73 +// }).promise();
74 +// const GetItemDrop = async (itemId) => {
75 +// const response = await axios({
76 +// method: 'post',
77 +// url: `http://df.nexon.com/FRM/game/epic_drop.php?id=${itemId}`,
78 +// headers: {
79 +// 'Accept': 'application/json, text/javascript, */*; q=0.01',
80 +// 'X-Requested-With': 'XMLHttpRequest',
81 +// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
82 +// 'Referer': `http://df.nexon.com/df/info/equipment/view?id=${itemId}&page=3&is_limit=&filter=204&max=100&min=100&level=Y&order_name=level&order_type=asc`,
83 +// },
84 +// });
85 +// return response.data;
86 +// };
87 +// (async () => {
88 +// const [item_list] = await connection.query('SELECT * FROM `item_exception`');
89 +// for (const item of item_list) {
90 +// const data = await GetItemDrop(item.itemId);
91 +// for (const drop of data) {
92 +// const input = {
93 +// itemId: drop.item_no,
94 +// channel_name: drop.channel_name,
95 +// channel_number: drop.channel_number,
96 +// dungeon: drop.dungeon,
97 +// droped_at: moment.unix(drop.time).format('YYYY-MM-DD HH:mm:ss'),
98 +// };
99 +// input['hash'] = crypto.createHash('md5').update(JSON.stringify(input)).digest('hex');
100 +// try {
101 +// await connection.query('INSERT INTO `item_drop_exception` SET ?', input);
102 +// } catch (e) {}
103 +// }
104 +// }
105 +// var dateT2 = moment().format('YYYY-MM-DD HH:mm:ss');
106 +// console.log("insert DB Done " + dateT2);
107 +// await connection.close();
108 +// })();
109 +// dateT = moment().format('YYYY-MM-DD HH:mm:ss');
110 +// console.log("done "+dateT);
111 +// });
1 +{
2 + "name": "df",
3 + "version": "1.0.0",
4 + "lockfileVersion": 1,
5 + "requires": true,
6 + "dependencies": {
7 + "ansicolors": {
8 + "version": "0.3.2",
9 + "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz",
10 + "integrity": "sha1-ZlWX3oap/+Oqm/vmyuXG6kJrSXk="
11 + },
12 + "axios": {
13 + "version": "0.19.2",
14 + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
15 + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
16 + "requires": {
17 + "follow-redirects": "1.5.10"
18 + }
19 + },
20 + "cardinal": {
21 + "version": "2.1.1",
22 + "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz",
23 + "integrity": "sha1-fMEFXYItISlU0HsIXeolHMe8VQU=",
24 + "requires": {
25 + "ansicolors": "~0.3.2",
26 + "redeyed": "~2.1.0"
27 + }
28 + },
29 + "debug": {
30 + "version": "3.1.0",
31 + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
32 + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
33 + "requires": {
34 + "ms": "2.0.0"
35 + }
36 + },
37 + "denque": {
38 + "version": "1.4.1",
39 + "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz",
40 + "integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ=="
41 + },
42 + "esprima": {
43 + "version": "4.0.1",
44 + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
45 + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
46 + },
47 + "follow-redirects": {
48 + "version": "1.5.10",
49 + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
50 + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
51 + "requires": {
52 + "debug": "=3.1.0"
53 + }
54 + },
55 + "generate-function": {
56 + "version": "2.3.1",
57 + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
58 + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",
59 + "requires": {
60 + "is-property": "^1.0.2"
61 + }
62 + },
63 + "iconv-lite": {
64 + "version": "0.5.1",
65 + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.1.tgz",
66 + "integrity": "sha512-ONHr16SQvKZNSqjQT9gy5z24Jw+uqfO02/ngBSBoqChZ+W8qXX7GPRa1RoUnzGADw8K63R1BXUMzarCVQBpY8Q==",
67 + "requires": {
68 + "safer-buffer": ">= 2.1.2 < 3"
69 + }
70 + },
71 + "is-property": {
72 + "version": "1.0.2",
73 + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
74 + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ="
75 + },
76 + "long": {
77 + "version": "4.0.0",
78 + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
79 + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
80 + },
81 + "lru-cache": {
82 + "version": "5.1.1",
83 + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
84 + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
85 + "requires": {
86 + "yallist": "^3.0.2"
87 + }
88 + },
89 + "moment": {
90 + "version": "2.25.3",
91 + "resolved": "https://registry.npmjs.org/moment/-/moment-2.25.3.tgz",
92 + "integrity": "sha512-PuYv0PHxZvzc15Sp8ybUCoQ+xpyPWvjOuK72a5ovzp2LI32rJXOiIfyoFoYvG3s6EwwrdkMyWuRiEHSZRLJNdg=="
93 + },
94 + "moment-timezone": {
95 + "version": "0.5.31",
96 + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.31.tgz",
97 + "integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==",
98 + "requires": {
99 + "moment": ">= 2.9.0"
100 + }
101 + },
102 + "ms": {
103 + "version": "2.0.0",
104 + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
105 + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
106 + },
107 + "mysql2": {
108 + "version": "2.1.0",
109 + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.1.0.tgz",
110 + "integrity": "sha512-9kGVyi930rG2KaHrz3sHwtc6K+GY9d8wWk1XRSYxQiunvGcn4DwuZxOwmK11ftuhhwrYDwGx9Ta4VBwznJn36A==",
111 + "requires": {
112 + "cardinal": "^2.1.1",
113 + "denque": "^1.4.1",
114 + "generate-function": "^2.3.1",
115 + "iconv-lite": "^0.5.0",
116 + "long": "^4.0.0",
117 + "lru-cache": "^5.1.1",
118 + "named-placeholders": "^1.1.2",
119 + "seq-queue": "^0.0.5",
120 + "sqlstring": "^2.3.1"
121 + }
122 + },
123 + "named-placeholders": {
124 + "version": "1.1.2",
125 + "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.2.tgz",
126 + "integrity": "sha512-wiFWqxoLL3PGVReSZpjLVxyJ1bRqe+KKJVbr4hGs1KWfTZTQyezHFBbuKj9hsizHyGV2ne7EMjHdxEGAybD5SA==",
127 + "requires": {
128 + "lru-cache": "^4.1.3"
129 + },
130 + "dependencies": {
131 + "lru-cache": {
132 + "version": "4.1.5",
133 + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
134 + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
135 + "requires": {
136 + "pseudomap": "^1.0.2",
137 + "yallist": "^2.1.2"
138 + }
139 + },
140 + "yallist": {
141 + "version": "2.1.2",
142 + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
143 + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
144 + }
145 + }
146 + },
147 + "node-cron": {
148 + "version": "2.0.3",
149 + "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-2.0.3.tgz",
150 + "integrity": "sha512-eJI+QitXlwcgiZwNNSRbqsjeZMp5shyajMR81RZCqeW0ZDEj4zU9tpd4nTh/1JsBiKbF8d08FCewiipDmVIYjg==",
151 + "requires": {
152 + "opencollective-postinstall": "^2.0.0",
153 + "tz-offset": "0.0.1"
154 + }
155 + },
156 + "opencollective-postinstall": {
157 + "version": "2.0.2",
158 + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz",
159 + "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw=="
160 + },
161 + "pseudomap": {
162 + "version": "1.0.2",
163 + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
164 + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
165 + },
166 + "redeyed": {
167 + "version": "2.1.1",
168 + "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-2.1.1.tgz",
169 + "integrity": "sha1-iYS1gV2ZyyIEacme7v/jiRPmzAs=",
170 + "requires": {
171 + "esprima": "~4.0.0"
172 + }
173 + },
174 + "safer-buffer": {
175 + "version": "2.1.2",
176 + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
177 + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
178 + },
179 + "seq-queue": {
180 + "version": "0.0.5",
181 + "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz",
182 + "integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4="
183 + },
184 + "sqlstring": {
185 + "version": "2.3.2",
186 + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.2.tgz",
187 + "integrity": "sha512-vF4ZbYdKS8OnoJAWBmMxCQDkiEBkGQYU7UZPtL8flbDRSNkhaXvRJ279ZtI6M+zDaQovVU4tuRgzK5fVhvFAhg=="
188 + },
189 + "tz-offset": {
190 + "version": "0.0.1",
191 + "resolved": "https://registry.npmjs.org/tz-offset/-/tz-offset-0.0.1.tgz",
192 + "integrity": "sha512-kMBmblijHJXyOpKzgDhKx9INYU4u4E1RPMB0HqmKSgWG8vEcf3exEfLh4FFfzd3xdQOw9EuIy/cP0akY6rHopQ=="
193 + },
194 + "yallist": {
195 + "version": "3.1.1",
196 + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
197 + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
198 + }
199 + }
200 +}
1 +{
2 + "name": "df",
3 + "version": "1.0.0",
4 + "description": "",
5 + "main": "crawl.js",
6 + "scripts": {
7 + "test": "echo \"Error: no test specified\" && exit 1"
8 + },
9 + "author": "",
10 + "license": "ISC",
11 + "dependencies": {
12 + "axios": "^0.19.2",
13 + "moment": "^2.25.3",
14 + "moment-timezone": "^0.5.31",
15 + "mysql2": "^2.1.0",
16 + "node-cron": "^2.0.3"
17 + }
18 +}
1 +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 +
3 +# dependencies
4 +/node_modules
5 +/.pnp
6 +.pnp.js
7 +
8 +# testing
9 +/coverage
10 +
11 +# production
12 +/build
13 +
14 +# misc
15 +.DS_Store
16 +.env.local
17 +.env.development.local
18 +.env.test.local
19 +.env.production.local
20 +
21 +npm-debug.log*
22 +yarn-debug.log*
23 +yarn-error.log*
1 +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2 +
3 +## Available Scripts
4 +
5 +In the project directory, you can run:
6 +
7 +### `yarn start`
8 +
9 +Runs the app in the development mode.<br />
10 +Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11 +
12 +The page will reload if you make edits.<br />
13 +You will also see any lint errors in the console.
14 +
15 +### `yarn test`
16 +
17 +Launches the test runner in the interactive watch mode.<br />
18 +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19 +
20 +### `yarn build`
21 +
22 +Builds the app for production to the `build` folder.<br />
23 +It correctly bundles React in production mode and optimizes the build for the best performance.
24 +
25 +The build is minified and the filenames include the hashes.<br />
26 +Your app is ready to be deployed!
27 +
28 +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29 +
30 +### `yarn eject`
31 +
32 +**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33 +
34 +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35 +
36 +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37 +
38 +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39 +
40 +## Learn More
41 +
42 +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43 +
44 +To learn React, check out the [React documentation](https://reactjs.org/).
45 +
46 +### Code Splitting
47 +
48 +This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49 +
50 +### Analyzing the Bundle Size
51 +
52 +This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53 +
54 +### Making a Progressive Web App
55 +
56 +This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57 +
58 +### Advanced Configuration
59 +
60 +This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61 +
62 +### Deployment
63 +
64 +This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65 +
66 +### `yarn build` fails to minify
67 +
68 +This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
1 +'use strict';
2 +
3 +const fs = require('fs');
4 +const path = require('path');
5 +const paths = require('./paths');
6 +
7 +// Make sure that including paths.js after env.js will read .env variables.
8 +delete require.cache[require.resolve('./paths')];
9 +
10 +const NODE_ENV = process.env.NODE_ENV;
11 +if (!NODE_ENV) {
12 + throw new Error(
13 + 'The NODE_ENV environment variable is required but was not specified.'
14 + );
15 +}
16 +
17 +// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
18 +const dotenvFiles = [
19 + `${paths.dotenv}.${NODE_ENV}.local`,
20 + `${paths.dotenv}.${NODE_ENV}`,
21 + // Don't include `.env.local` for `test` environment
22 + // since normally you expect tests to produce the same
23 + // results for everyone
24 + NODE_ENV !== 'test' && `${paths.dotenv}.local`,
25 + paths.dotenv,
26 +].filter(Boolean);
27 +
28 +// Load environment variables from .env* files. Suppress warnings using silent
29 +// if this file is missing. dotenv will never modify any environment variables
30 +// that have already been set. Variable expansion is supported in .env files.
31 +// https://github.com/motdotla/dotenv
32 +// https://github.com/motdotla/dotenv-expand
33 +dotenvFiles.forEach(dotenvFile => {
34 + if (fs.existsSync(dotenvFile)) {
35 + require('dotenv-expand')(
36 + require('dotenv').config({
37 + path: dotenvFile,
38 + })
39 + );
40 + }
41 +});
42 +
43 +// We support resolving modules according to `NODE_PATH`.
44 +// This lets you use absolute paths in imports inside large monorepos:
45 +// https://github.com/facebook/create-react-app/issues/253.
46 +// It works similar to `NODE_PATH` in Node itself:
47 +// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
48 +// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
49 +// Otherwise, we risk importing Node.js core modules into an app instead of webpack shims.
50 +// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
51 +// We also resolve them to make sure all tools using them work consistently.
52 +const appDirectory = fs.realpathSync(process.cwd());
53 +process.env.NODE_PATH = (process.env.NODE_PATH || '')
54 + .split(path.delimiter)
55 + .filter(folder => folder && !path.isAbsolute(folder))
56 + .map(folder => path.resolve(appDirectory, folder))
57 + .join(path.delimiter);
58 +
59 +// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
60 +// injected into the application via DefinePlugin in webpack configuration.
61 +const REACT_APP = /^REACT_APP_/i;
62 +
63 +function getClientEnvironment(publicUrl) {
64 + const raw = Object.keys(process.env)
65 + .filter(key => REACT_APP.test(key))
66 + .reduce(
67 + (env, key) => {
68 + env[key] = process.env[key];
69 + return env;
70 + },
71 + {
72 + // Useful for determining whether we’re running in production mode.
73 + // Most importantly, it switches React into the correct mode.
74 + NODE_ENV: process.env.NODE_ENV || 'development',
75 + // Useful for resolving the correct path to static assets in `public`.
76 + // For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
77 + // This should only be used as an escape hatch. Normally you would put
78 + // images into the `src` and `import` them in code to get their paths.
79 + PUBLIC_URL: publicUrl,
80 + // We support configuring the sockjs pathname during development.
81 + // These settings let a developer run multiple simultaneous projects.
82 + // They are used as the connection `hostname`, `pathname` and `port`
83 + // in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
84 + // and `sockPort` options in webpack-dev-server.
85 + WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
86 + WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
87 + WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
88 + }
89 + );
90 + // Stringify all values so we can feed into webpack DefinePlugin
91 + const stringified = {
92 + 'process.env': Object.keys(raw).reduce((env, key) => {
93 + env[key] = JSON.stringify(raw[key]);
94 + return env;
95 + }, {}),
96 + };
97 +
98 + return { raw, stringified };
99 +}
100 +
101 +module.exports = getClientEnvironment;
1 +'use strict';
2 +
3 +const fs = require('fs');
4 +const path = require('path');
5 +const crypto = require('crypto');
6 +const chalk = require('react-dev-utils/chalk');
7 +const paths = require('./paths');
8 +
9 +// Ensure the certificate and key provided are valid and if not
10 +// throw an easy to debug error
11 +function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
12 + let encrypted;
13 + try {
14 + // publicEncrypt will throw an error with an invalid cert
15 + encrypted = crypto.publicEncrypt(cert, Buffer.from('test'));
16 + } catch (err) {
17 + throw new Error(
18 + `The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`
19 + );
20 + }
21 +
22 + try {
23 + // privateDecrypt will throw an error with an invalid key
24 + crypto.privateDecrypt(key, encrypted);
25 + } catch (err) {
26 + throw new Error(
27 + `The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${
28 + err.message
29 + }`
30 + );
31 + }
32 +}
33 +
34 +// Read file and throw an error if it doesn't exist
35 +function readEnvFile(file, type) {
36 + if (!fs.existsSync(file)) {
37 + throw new Error(
38 + `You specified ${chalk.cyan(
39 + type
40 + )} in your env, but the file "${chalk.yellow(file)}" can't be found.`
41 + );
42 + }
43 + return fs.readFileSync(file);
44 +}
45 +
46 +// Get the https config
47 +// Return cert files if provided in env, otherwise just true or false
48 +function getHttpsConfig() {
49 + const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
50 + const isHttps = HTTPS === 'true';
51 +
52 + if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
53 + const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
54 + const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
55 + const config = {
56 + cert: readEnvFile(crtFile, 'SSL_CRT_FILE'),
57 + key: readEnvFile(keyFile, 'SSL_KEY_FILE'),
58 + };
59 +
60 + validateKeyAndCerts({ ...config, keyFile, crtFile });
61 + return config;
62 + }
63 + return isHttps;
64 +}
65 +
66 +module.exports = getHttpsConfig;
1 +'use strict';
2 +
3 +// This is a custom Jest transformer turning style imports into empty objects.
4 +// http://facebook.github.io/jest/docs/en/webpack.html
5 +
6 +module.exports = {
7 + process() {
8 + return 'module.exports = {};';
9 + },
10 + getCacheKey() {
11 + // The output is always the same.
12 + return 'cssTransform';
13 + },
14 +};
1 +'use strict';
2 +
3 +const path = require('path');
4 +const camelcase = require('camelcase');
5 +
6 +// This is a custom Jest transformer turning file imports into filenames.
7 +// http://facebook.github.io/jest/docs/en/webpack.html
8 +
9 +module.exports = {
10 + process(src, filename) {
11 + const assetFilename = JSON.stringify(path.basename(filename));
12 +
13 + if (filename.match(/\.svg$/)) {
14 + // Based on how SVGR generates a component name:
15 + // https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
16 + const pascalCaseFilename = camelcase(path.parse(filename).name, {
17 + pascalCase: true,
18 + });
19 + const componentName = `Svg${pascalCaseFilename}`;
20 + return `const React = require('react');
21 + module.exports = {
22 + __esModule: true,
23 + default: ${assetFilename},
24 + ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
25 + return {
26 + $$typeof: Symbol.for('react.element'),
27 + type: 'svg',
28 + ref: ref,
29 + key: null,
30 + props: Object.assign({}, props, {
31 + children: ${assetFilename}
32 + })
33 + };
34 + }),
35 + };`;
36 + }
37 +
38 + return `module.exports = ${assetFilename};`;
39 + },
40 +};
1 +'use strict';
2 +
3 +const fs = require('fs');
4 +const path = require('path');
5 +const paths = require('./paths');
6 +const chalk = require('react-dev-utils/chalk');
7 +const resolve = require('resolve');
8 +
9 +/**
10 + * Get additional module paths based on the baseUrl of a compilerOptions object.
11 + *
12 + * @param {Object} options
13 + */
14 +function getAdditionalModulePaths(options = {}) {
15 + const baseUrl = options.baseUrl;
16 +
17 + // We need to explicitly check for null and undefined (and not a falsy value) because
18 + // TypeScript treats an empty string as `.`.
19 + if (baseUrl == null) {
20 + // If there's no baseUrl set we respect NODE_PATH
21 + // Note that NODE_PATH is deprecated and will be removed
22 + // in the next major release of create-react-app.
23 +
24 + const nodePath = process.env.NODE_PATH || '';
25 + return nodePath.split(path.delimiter).filter(Boolean);
26 + }
27 +
28 + const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
29 +
30 + // We don't need to do anything if `baseUrl` is set to `node_modules`. This is
31 + // the default behavior.
32 + if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
33 + return null;
34 + }
35 +
36 + // Allow the user set the `baseUrl` to `appSrc`.
37 + if (path.relative(paths.appSrc, baseUrlResolved) === '') {
38 + return [paths.appSrc];
39 + }
40 +
41 + // If the path is equal to the root directory we ignore it here.
42 + // We don't want to allow importing from the root directly as source files are
43 + // not transpiled outside of `src`. We do allow importing them with the
44 + // absolute path (e.g. `src/Components/Button.js`) but we set that up with
45 + // an alias.
46 + if (path.relative(paths.appPath, baseUrlResolved) === '') {
47 + return null;
48 + }
49 +
50 + // Otherwise, throw an error.
51 + throw new Error(
52 + chalk.red.bold(
53 + "Your project's `baseUrl` can only be set to `src` or `node_modules`." +
54 + ' Create React App does not support other values at this time.'
55 + )
56 + );
57 +}
58 +
59 +/**
60 + * Get webpack aliases based on the baseUrl of a compilerOptions object.
61 + *
62 + * @param {*} options
63 + */
64 +function getWebpackAliases(options = {}) {
65 + const baseUrl = options.baseUrl;
66 +
67 + if (!baseUrl) {
68 + return {};
69 + }
70 +
71 + const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
72 +
73 + if (path.relative(paths.appPath, baseUrlResolved) === '') {
74 + return {
75 + src: paths.appSrc,
76 + };
77 + }
78 +}
79 +
80 +/**
81 + * Get jest aliases based on the baseUrl of a compilerOptions object.
82 + *
83 + * @param {*} options
84 + */
85 +function getJestAliases(options = {}) {
86 + const baseUrl = options.baseUrl;
87 +
88 + if (!baseUrl) {
89 + return {};
90 + }
91 +
92 + const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
93 +
94 + if (path.relative(paths.appPath, baseUrlResolved) === '') {
95 + return {
96 + '^src/(.*)$': '<rootDir>/src/$1',
97 + };
98 + }
99 +}
100 +
101 +function getModules() {
102 + // Check if TypeScript is setup
103 + const hasTsConfig = fs.existsSync(paths.appTsConfig);
104 + const hasJsConfig = fs.existsSync(paths.appJsConfig);
105 +
106 + if (hasTsConfig && hasJsConfig) {
107 + throw new Error(
108 + 'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
109 + );
110 + }
111 +
112 + let config;
113 +
114 + // If there's a tsconfig.json we assume it's a
115 + // TypeScript project and set up the config
116 + // based on tsconfig.json
117 + if (hasTsConfig) {
118 + const ts = require(resolve.sync('typescript', {
119 + basedir: paths.appNodeModules,
120 + }));
121 + config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
122 + // Otherwise we'll check if there is jsconfig.json
123 + // for non TS projects.
124 + } else if (hasJsConfig) {
125 + config = require(paths.appJsConfig);
126 + }
127 +
128 + config = config || {};
129 + const options = config.compilerOptions || {};
130 +
131 + const additionalModulePaths = getAdditionalModulePaths(options);
132 +
133 + return {
134 + additionalModulePaths: additionalModulePaths,
135 + webpackAliases: getWebpackAliases(options),
136 + jestAliases: getJestAliases(options),
137 + hasTsConfig,
138 + };
139 +}
140 +
141 +module.exports = getModules();
1 +'use strict';
2 +
3 +const path = require('path');
4 +const fs = require('fs');
5 +const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
6 +
7 +// Make sure any symlinks in the project folder are resolved:
8 +// https://github.com/facebook/create-react-app/issues/637
9 +const appDirectory = fs.realpathSync(process.cwd());
10 +const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
11 +
12 +// We use `PUBLIC_URL` environment variable or "homepage" field to infer
13 +// "public path" at which the app is served.
14 +// webpack needs to know it to put the right <script> hrefs into HTML even in
15 +// single-page apps that may serve index.html for nested URLs like /todos/42.
16 +// We can't use a relative path in HTML because we don't want to load something
17 +// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
18 +const publicUrlOrPath = getPublicUrlOrPath(
19 + process.env.NODE_ENV === 'development',
20 + require(resolveApp('package.json')).homepage,
21 + process.env.PUBLIC_URL
22 +);
23 +
24 +const moduleFileExtensions = [
25 + 'web.mjs',
26 + 'mjs',
27 + 'web.js',
28 + 'js',
29 + 'web.ts',
30 + 'ts',
31 + 'web.tsx',
32 + 'tsx',
33 + 'json',
34 + 'web.jsx',
35 + 'jsx',
36 +];
37 +
38 +// Resolve file paths in the same order as webpack
39 +const resolveModule = (resolveFn, filePath) => {
40 + const extension = moduleFileExtensions.find(extension =>
41 + fs.existsSync(resolveFn(`${filePath}.${extension}`))
42 + );
43 +
44 + if (extension) {
45 + return resolveFn(`${filePath}.${extension}`);
46 + }
47 +
48 + return resolveFn(`${filePath}.js`);
49 +};
50 +
51 +// config after eject: we're in ./config/
52 +module.exports = {
53 + dotenv: resolveApp('.env'),
54 + appPath: resolveApp('.'),
55 + appBuild: resolveApp('build'),
56 + appPublic: resolveApp('public'),
57 + appHtml: resolveApp('public/index.html'),
58 + appIndexJs: resolveModule(resolveApp, 'src/index'),
59 + appPackageJson: resolveApp('package.json'),
60 + appSrc: resolveApp('src'),
61 + appTsConfig: resolveApp('tsconfig.json'),
62 + appJsConfig: resolveApp('jsconfig.json'),
63 + yarnLockFile: resolveApp('yarn.lock'),
64 + testsSetup: resolveModule(resolveApp, 'src/setupTests'),
65 + proxySetup: resolveApp('src/setupProxy.js'),
66 + appNodeModules: resolveApp('node_modules'),
67 + publicUrlOrPath,
68 +};
69 +
70 +
71 +
72 +module.exports.moduleFileExtensions = moduleFileExtensions;
1 +'use strict';
2 +
3 +const { resolveModuleName } = require('ts-pnp');
4 +
5 +exports.resolveModuleName = (
6 + typescript,
7 + moduleName,
8 + containingFile,
9 + compilerOptions,
10 + resolutionHost
11 +) => {
12 + return resolveModuleName(
13 + moduleName,
14 + containingFile,
15 + compilerOptions,
16 + resolutionHost,
17 + typescript.resolveModuleName
18 + );
19 +};
20 +
21 +exports.resolveTypeReferenceDirective = (
22 + typescript,
23 + moduleName,
24 + containingFile,
25 + compilerOptions,
26 + resolutionHost
27 +) => {
28 + return resolveModuleName(
29 + moduleName,
30 + containingFile,
31 + compilerOptions,
32 + resolutionHost,
33 + typescript.resolveTypeReferenceDirective
34 + );
35 +};
1 +'use strict';
2 +
3 +const fs = require('fs');
4 +const path = require('path');
5 +const webpack = require('webpack');
6 +const resolve = require('resolve');
7 +const PnpWebpackPlugin = require('pnp-webpack-plugin');
8 +const HtmlWebpackPlugin = require('html-webpack-plugin');
9 +const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
10 +const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
11 +const TerserPlugin = require('terser-webpack-plugin');
12 +const MiniCssExtractPlugin = require('mini-css-extract-plugin');
13 +const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
14 +const safePostCssParser = require('postcss-safe-parser');
15 +const ManifestPlugin = require('webpack-manifest-plugin');
16 +const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
17 +const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
18 +const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
19 +const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
20 +const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
21 +const paths = require('./paths');
22 +const modules = require('./modules');
23 +const getClientEnvironment = require('./env');
24 +const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
25 +const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
26 +const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
27 +
28 +const postcssNormalize = require('postcss-normalize');
29 +
30 +const appPackageJson = require(paths.appPackageJson);
31 +
32 +// Source maps are resource heavy and can cause out of memory issue for large source files.
33 +const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
34 +// Some apps do not need the benefits of saving a web request, so not inlining the chunk
35 +// makes for a smoother build process.
36 +const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
37 +
38 +const isExtendingEslintConfig = process.env.EXTEND_ESLINT === 'true';
39 +
40 +const imageInlineSizeLimit = parseInt(
41 + process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
42 +);
43 +
44 +// Check if TypeScript is setup
45 +const useTypeScript = fs.existsSync(paths.appTsConfig);
46 +
47 +// style files regexes
48 +const cssRegex = /\.css$/;
49 +const cssModuleRegex = /\.module\.css$/;
50 +const sassRegex = /\.(scss|sass)$/;
51 +const sassModuleRegex = /\.module\.(scss|sass)$/;
52 +
53 +// This is the production and development configuration.
54 +// It is focused on developer experience, fast rebuilds, and a minimal bundle.
55 +module.exports = function(webpackEnv) {
56 + const isEnvDevelopment = webpackEnv === 'development';
57 + const isEnvProduction = webpackEnv === 'production';
58 +
59 + // Variable used for enabling profiling in Production
60 + // passed into alias object. Uses a flag if passed into the build command
61 + const isEnvProductionProfile =
62 + isEnvProduction && process.argv.includes('--profile');
63 +
64 + // We will provide `paths.publicUrlOrPath` to our app
65 + // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
66 + // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
67 + // Get environment variables to inject into our app.
68 + const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
69 +
70 + // common function to get style loaders
71 + const getStyleLoaders = (cssOptions, preProcessor) => {
72 + const loaders = [
73 + isEnvDevelopment && require.resolve('style-loader'),
74 + isEnvProduction && {
75 + loader: MiniCssExtractPlugin.loader,
76 + // css is located in `static/css`, use '../../' to locate index.html folder
77 + // in production `paths.publicUrlOrPath` can be a relative path
78 + options: paths.publicUrlOrPath.startsWith('.')
79 + ? { publicPath: '../../' }
80 + : {},
81 + },
82 + {
83 + loader: require.resolve('css-loader'),
84 + options: cssOptions,
85 + },
86 + {
87 + // Options for PostCSS as we reference these options twice
88 + // Adds vendor prefixing based on your specified browser support in
89 + // package.json
90 + loader: require.resolve('postcss-loader'),
91 + options: {
92 + // Necessary for external CSS imports to work
93 + // https://github.com/facebook/create-react-app/issues/2677
94 + ident: 'postcss',
95 + plugins: () => [
96 + require('postcss-flexbugs-fixes'),
97 + require('postcss-preset-env')({
98 + autoprefixer: {
99 + flexbox: 'no-2009',
100 + },
101 + stage: 3,
102 + }),
103 + // Adds PostCSS Normalize as the reset css with default options,
104 + // so that it honors browserslist config in package.json
105 + // which in turn let's users customize the target behavior as per their needs.
106 + postcssNormalize(),
107 + ],
108 + sourceMap: isEnvProduction && shouldUseSourceMap,
109 + },
110 + },
111 + ].filter(Boolean);
112 + if (preProcessor) {
113 + loaders.push(
114 + {
115 + loader: require.resolve('resolve-url-loader'),
116 + options: {
117 + sourceMap: isEnvProduction && shouldUseSourceMap,
118 + },
119 + },
120 + {
121 + loader: require.resolve(preProcessor),
122 + options: {
123 + sourceMap: true,
124 + },
125 + }
126 + );
127 + }
128 + return loaders;
129 + };
130 +
131 + return {
132 + mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
133 + // Stop compilation early in production
134 + bail: isEnvProduction,
135 + devtool: isEnvProduction
136 + ? shouldUseSourceMap
137 + ? 'source-map'
138 + : false
139 + : isEnvDevelopment && 'cheap-module-source-map',
140 + // These are the "entry points" to our application.
141 + // This means they will be the "root" imports that are included in JS bundle.
142 + entry: [
143 + // Include an alternative client for WebpackDevServer. A client's job is to
144 + // connect to WebpackDevServer by a socket and get notified about changes.
145 + // When you save a file, the client will either apply hot updates (in case
146 + // of CSS changes), or refresh the page (in case of JS changes). When you
147 + // make a syntax error, this client will display a syntax error overlay.
148 + // Note: instead of the default WebpackDevServer client, we use a custom one
149 + // to bring better experience for Create React App users. You can replace
150 + // the line below with these two lines if you prefer the stock client:
151 + // require.resolve('webpack-dev-server/client') + '?/',
152 + // require.resolve('webpack/hot/dev-server'),
153 + isEnvDevelopment &&
154 + require.resolve('react-dev-utils/webpackHotDevClient'),
155 + // Finally, this is your app's code:
156 + paths.appIndexJs,
157 + // We include the app code last so that if there is a runtime error during
158 + // initialization, it doesn't blow up the WebpackDevServer client, and
159 + // changing JS code would still trigger a refresh.
160 + ].filter(Boolean),
161 + output: {
162 + // The build folder.
163 + path: isEnvProduction ? paths.appBuild : undefined,
164 + // Add /* filename */ comments to generated require()s in the output.
165 + pathinfo: isEnvDevelopment,
166 + // There will be one main bundle, and one file per asynchronous chunk.
167 + // In development, it does not produce real files.
168 + filename: isEnvProduction
169 + ? 'static/js/[name].[contenthash:8].js'
170 + : isEnvDevelopment && 'static/js/bundle.js',
171 + // TODO: remove this when upgrading to webpack 5
172 + futureEmitAssets: true,
173 + // There are also additional JS chunk files if you use code splitting.
174 + chunkFilename: isEnvProduction
175 + ? 'static/js/[name].[contenthash:8].chunk.js'
176 + : isEnvDevelopment && 'static/js/[name].chunk.js',
177 + // webpack uses `publicPath` to determine where the app is being served from.
178 + // It requires a trailing slash, or the file assets will get an incorrect path.
179 + // We inferred the "public path" (such as / or /my-project) from homepage.
180 + publicPath: paths.publicUrlOrPath,
181 + // Point sourcemap entries to original disk location (format as URL on Windows)
182 + devtoolModuleFilenameTemplate: isEnvProduction
183 + ? info =>
184 + path
185 + .relative(paths.appSrc, info.absoluteResourcePath)
186 + .replace(/\\/g, '/')
187 + : isEnvDevelopment &&
188 + (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
189 + // Prevents conflicts when multiple webpack runtimes (from different apps)
190 + // are used on the same page.
191 + jsonpFunction: `webpackJsonp${appPackageJson.name}`,
192 + // this defaults to 'window', but by setting it to 'this' then
193 + // module chunks which are built will work in web workers as well.
194 + globalObject: 'this',
195 + },
196 + optimization: {
197 + minimize: isEnvProduction,
198 + minimizer: [
199 + // This is only used in production mode
200 + new TerserPlugin({
201 + terserOptions: {
202 + parse: {
203 + // We want terser to parse ecma 8 code. However, we don't want it
204 + // to apply any minification steps that turns valid ecma 5 code
205 + // into invalid ecma 5 code. This is why the 'compress' and 'output'
206 + // sections only apply transformations that are ecma 5 safe
207 + // https://github.com/facebook/create-react-app/pull/4234
208 + ecma: 8,
209 + },
210 + compress: {
211 + ecma: 5,
212 + warnings: false,
213 + // Disabled because of an issue with Uglify breaking seemingly valid code:
214 + // https://github.com/facebook/create-react-app/issues/2376
215 + // Pending further investigation:
216 + // https://github.com/mishoo/UglifyJS2/issues/2011
217 + comparisons: false,
218 + // Disabled because of an issue with Terser breaking valid code:
219 + // https://github.com/facebook/create-react-app/issues/5250
220 + // Pending further investigation:
221 + // https://github.com/terser-js/terser/issues/120
222 + inline: 2,
223 + },
224 + mangle: {
225 + safari10: true,
226 + },
227 + // Added for profiling in devtools
228 + keep_classnames: isEnvProductionProfile,
229 + keep_fnames: isEnvProductionProfile,
230 + output: {
231 + ecma: 5,
232 + comments: false,
233 + // Turned on because emoji and regex is not minified properly using default
234 + // https://github.com/facebook/create-react-app/issues/2488
235 + ascii_only: true,
236 + },
237 + },
238 + sourceMap: shouldUseSourceMap,
239 + }),
240 + // This is only used in production mode
241 + new OptimizeCSSAssetsPlugin({
242 + cssProcessorOptions: {
243 + parser: safePostCssParser,
244 + map: shouldUseSourceMap
245 + ? {
246 + // `inline: false` forces the sourcemap to be output into a
247 + // separate file
248 + inline: false,
249 + // `annotation: true` appends the sourceMappingURL to the end of
250 + // the css file, helping the browser find the sourcemap
251 + annotation: true,
252 + }
253 + : false,
254 + },
255 + cssProcessorPluginOptions: {
256 + preset: ['default', { minifyFontValues: { removeQuotes: false } }],
257 + },
258 + }),
259 + ],
260 + // Automatically split vendor and commons
261 + // https://twitter.com/wSokra/status/969633336732905474
262 + // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
263 + splitChunks: {
264 + chunks: 'all',
265 + name: false,
266 + },
267 + // Keep the runtime chunk separated to enable long term caching
268 + // https://twitter.com/wSokra/status/969679223278505985
269 + // https://github.com/facebook/create-react-app/issues/5358
270 + runtimeChunk: {
271 + name: entrypoint => `runtime-${entrypoint.name}`,
272 + },
273 + },
274 + resolve: {
275 + // This allows you to set a fallback for where webpack should look for modules.
276 + // We placed these paths second because we want `node_modules` to "win"
277 + // if there are any conflicts. This matches Node resolution mechanism.
278 + // https://github.com/facebook/create-react-app/issues/253
279 + modules: ['node_modules', paths.appNodeModules].concat(
280 + modules.additionalModulePaths || []
281 + ),
282 + // These are the reasonable defaults supported by the Node ecosystem.
283 + // We also include JSX as a common component filename extension to support
284 + // some tools, although we do not recommend using it, see:
285 + // https://github.com/facebook/create-react-app/issues/290
286 + // `web` extension prefixes have been added for better support
287 + // for React Native Web.
288 + extensions: paths.moduleFileExtensions
289 + .map(ext => `.${ext}`)
290 + .filter(ext => useTypeScript || !ext.includes('ts')),
291 + alias: {
292 + // Support React Native Web
293 + // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
294 + 'react-native': 'react-native-web',
295 + // Allows for better profiling with ReactDevTools
296 + ...(isEnvProductionProfile && {
297 + 'react-dom$': 'react-dom/profiling',
298 + 'scheduler/tracing': 'scheduler/tracing-profiling',
299 + }),
300 + ...(modules.webpackAliases || {}),
301 + },
302 + plugins: [
303 + // Adds support for installing with Plug'n'Play, leading to faster installs and adding
304 + // guards against forgotten dependencies and such.
305 + PnpWebpackPlugin,
306 + // Prevents users from importing files from outside of src/ (or node_modules/).
307 + // This often causes confusion because we only process files within src/ with babel.
308 + // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
309 + // please link the files into your node_modules/ and let module-resolution kick in.
310 + // Make sure your source files are compiled, as they will not be processed in any way.
311 + new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
312 + ],
313 + },
314 + resolveLoader: {
315 + plugins: [
316 + // Also related to Plug'n'Play, but this time it tells webpack to load its loaders
317 + // from the current package.
318 + PnpWebpackPlugin.moduleLoader(module),
319 + ],
320 + },
321 + module: {
322 + strictExportPresence: true,
323 + rules: [
324 + // Disable require.ensure as it's not a standard language feature.
325 + { parser: { requireEnsure: false } },
326 +
327 + // First, run the linter.
328 + // It's important to do this before Babel processes the JS.
329 + {
330 + test: /\.(js|mjs|jsx|ts|tsx)$/,
331 + enforce: 'pre',
332 + use: [
333 + {
334 + options: {
335 + cache: true,
336 + formatter: require.resolve('react-dev-utils/eslintFormatter'),
337 + eslintPath: require.resolve('eslint'),
338 + resolvePluginsRelativeTo: __dirname,
339 +
340 + },
341 + loader: require.resolve('eslint-loader'),
342 + },
343 + ],
344 + include: paths.appSrc,
345 + },
346 + {
347 + // "oneOf" will traverse all following loaders until one will
348 + // match the requirements. When no loader matches it will fall
349 + // back to the "file" loader at the end of the loader list.
350 + oneOf: [
351 + // "url" loader works like "file" loader except that it embeds assets
352 + // smaller than specified limit in bytes as data URLs to avoid requests.
353 + // A missing `test` is equivalent to a match.
354 + {
355 + test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
356 + loader: require.resolve('url-loader'),
357 + options: {
358 + limit: imageInlineSizeLimit,
359 + name: 'static/media/[name].[hash:8].[ext]',
360 + },
361 + },
362 + // Process application JS with Babel.
363 + // The preset includes JSX, Flow, TypeScript, and some ESnext features.
364 + {
365 + test: /\.(js|mjs|jsx|ts|tsx)$/,
366 + include: paths.appSrc,
367 + loader: require.resolve('babel-loader'),
368 + options: {
369 + customize: require.resolve(
370 + 'babel-preset-react-app/webpack-overrides'
371 + ),
372 +
373 + plugins: [
374 + [
375 + require.resolve('babel-plugin-named-asset-import'),
376 + {
377 + loaderMap: {
378 + svg: {
379 + ReactComponent:
380 + '@svgr/webpack?-svgo,+titleProp,+ref![path]',
381 + },
382 + },
383 + },
384 + ],
385 + ],
386 + // This is a feature of `babel-loader` for webpack (not Babel itself).
387 + // It enables caching results in ./node_modules/.cache/babel-loader/
388 + // directory for faster rebuilds.
389 + cacheDirectory: true,
390 + // See #6846 for context on why cacheCompression is disabled
391 + cacheCompression: false,
392 + compact: isEnvProduction,
393 + },
394 + },
395 + // Process any JS outside of the app with Babel.
396 + // Unlike the application JS, we only compile the standard ES features.
397 + {
398 + test: /\.(js|mjs)$/,
399 + exclude: /@babel(?:\/|\\{1,2})runtime/,
400 + loader: require.resolve('babel-loader'),
401 + options: {
402 + babelrc: false,
403 + configFile: false,
404 + compact: false,
405 + presets: [
406 + [
407 + require.resolve('babel-preset-react-app/dependencies'),
408 + { helpers: true },
409 + ],
410 + ],
411 + cacheDirectory: true,
412 + // See #6846 for context on why cacheCompression is disabled
413 + cacheCompression: false,
414 +
415 + // Babel sourcemaps are needed for debugging into node_modules
416 + // code. Without the options below, debuggers like VSCode
417 + // show incorrect code and set breakpoints on the wrong lines.
418 + sourceMaps: shouldUseSourceMap,
419 + inputSourceMap: shouldUseSourceMap,
420 + },
421 + },
422 + // "postcss" loader applies autoprefixer to our CSS.
423 + // "css" loader resolves paths in CSS and adds assets as dependencies.
424 + // "style" loader turns CSS into JS modules that inject <style> tags.
425 + // In production, we use MiniCSSExtractPlugin to extract that CSS
426 + // to a file, but in development "style" loader enables hot editing
427 + // of CSS.
428 + // By default we support CSS Modules with the extension .module.css
429 + {
430 + test: cssRegex,
431 + exclude: cssModuleRegex,
432 + use: getStyleLoaders({
433 + importLoaders: 1,
434 + sourceMap: isEnvProduction && shouldUseSourceMap,
435 + }),
436 + // Don't consider CSS imports dead code even if the
437 + // containing package claims to have no side effects.
438 + // Remove this when webpack adds a warning or an error for this.
439 + // See https://github.com/webpack/webpack/issues/6571
440 + sideEffects: true,
441 + },
442 + // Adds support for CSS Modules (https://github.com/css-modules/css-modules)
443 + // using the extension .module.css
444 + {
445 + test: cssModuleRegex,
446 + use: getStyleLoaders({
447 + importLoaders: 1,
448 + sourceMap: isEnvProduction && shouldUseSourceMap,
449 + modules: {
450 + getLocalIdent: getCSSModuleLocalIdent,
451 + },
452 + }),
453 + },
454 + // Opt-in support for SASS (using .scss or .sass extensions).
455 + // By default we support SASS Modules with the
456 + // extensions .module.scss or .module.sass
457 + {
458 + test: sassRegex,
459 + exclude: sassModuleRegex,
460 + use: getStyleLoaders(
461 + {
462 + importLoaders: 3,
463 + sourceMap: isEnvProduction && shouldUseSourceMap,
464 + },
465 + 'sass-loader'
466 + ),
467 + // Don't consider CSS imports dead code even if the
468 + // containing package claims to have no side effects.
469 + // Remove this when webpack adds a warning or an error for this.
470 + // See https://github.com/webpack/webpack/issues/6571
471 + sideEffects: true,
472 + },
473 + // Adds support for CSS Modules, but using SASS
474 + // using the extension .module.scss or .module.sass
475 + {
476 + test: sassModuleRegex,
477 + use: getStyleLoaders(
478 + {
479 + importLoaders: 3,
480 + sourceMap: isEnvProduction && shouldUseSourceMap,
481 + modules: {
482 + getLocalIdent: getCSSModuleLocalIdent,
483 + },
484 + },
485 + 'sass-loader'
486 + ),
487 + },
488 + // "file" loader makes sure those assets get served by WebpackDevServer.
489 + // When you `import` an asset, you get its (virtual) filename.
490 + // In production, they would get copied to the `build` folder.
491 + // This loader doesn't use a "test" so it will catch all modules
492 + // that fall through the other loaders.
493 + {
494 + loader: require.resolve('file-loader'),
495 + // Exclude `js` files to keep "css" loader working as it injects
496 + // its runtime that would otherwise be processed through "file" loader.
497 + // Also exclude `html` and `json` extensions so they get processed
498 + // by webpacks internal loaders.
499 + exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
500 + options: {
501 + name: 'static/media/[name].[hash:8].[ext]',
502 + },
503 + },
504 + // ** STOP ** Are you adding a new loader?
505 + // Make sure to add the new loader(s) before the "file" loader.
506 + ],
507 + },
508 + ],
509 + },
510 + plugins: [
511 + // Generates an `index.html` file with the <script> injected.
512 + new HtmlWebpackPlugin(
513 + Object.assign(
514 + {},
515 + {
516 + inject: true,
517 + template: paths.appHtml,
518 + },
519 + isEnvProduction
520 + ? {
521 + minify: {
522 + removeComments: true,
523 + collapseWhitespace: true,
524 + removeRedundantAttributes: true,
525 + useShortDoctype: true,
526 + removeEmptyAttributes: true,
527 + removeStyleLinkTypeAttributes: true,
528 + keepClosingSlash: true,
529 + minifyJS: true,
530 + minifyCSS: true,
531 + minifyURLs: true,
532 + },
533 + }
534 + : undefined
535 + )
536 + ),
537 + // Inlines the webpack runtime script. This script is too small to warrant
538 + // a network request.
539 + // https://github.com/facebook/create-react-app/issues/5358
540 + isEnvProduction &&
541 + shouldInlineRuntimeChunk &&
542 + new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
543 + // Makes some environment variables available in index.html.
544 + // The public URL is available as %PUBLIC_URL% in index.html, e.g.:
545 + // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
546 + // It will be an empty string unless you specify "homepage"
547 + // in `package.json`, in which case it will be the pathname of that URL.
548 + new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
549 + // This gives some necessary context to module not found errors, such as
550 + // the requesting resource.
551 + new ModuleNotFoundPlugin(paths.appPath),
552 + // Makes some environment variables available to the JS code, for example:
553 + // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
554 + // It is absolutely essential that NODE_ENV is set to production
555 + // during a production build.
556 + // Otherwise React will be compiled in the very slow development mode.
557 + new webpack.DefinePlugin(env.stringified),
558 + // This is necessary to emit hot updates (currently CSS only):
559 + isEnvDevelopment && new webpack.HotModuleReplacementPlugin(),
560 + // Watcher doesn't work well if you mistype casing in a path so we use
561 + // a plugin that prints an error when you attempt to do this.
562 + // See https://github.com/facebook/create-react-app/issues/240
563 + isEnvDevelopment && new CaseSensitivePathsPlugin(),
564 + // If you require a missing module and then `npm install` it, you still have
565 + // to restart the development server for webpack to discover it. This plugin
566 + // makes the discovery automatic so you don't have to restart.
567 + // See https://github.com/facebook/create-react-app/issues/186
568 + isEnvDevelopment &&
569 + new WatchMissingNodeModulesPlugin(paths.appNodeModules),
570 + isEnvProduction &&
571 + new MiniCssExtractPlugin({
572 + // Options similar to the same options in webpackOptions.output
573 + // both options are optional
574 + filename: 'static/css/[name].[contenthash:8].css',
575 + chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
576 + }),
577 + // Generate an asset manifest file with the following content:
578 + // - "files" key: Mapping of all asset filenames to their corresponding
579 + // output file so that tools can pick it up without having to parse
580 + // `index.html`
581 + // - "entrypoints" key: Array of files which are included in `index.html`,
582 + // can be used to reconstruct the HTML if necessary
583 + new ManifestPlugin({
584 + fileName: 'asset-manifest.json',
585 + publicPath: paths.publicUrlOrPath,
586 + generate: (seed, files, entrypoints) => {
587 + const manifestFiles = files.reduce((manifest, file) => {
588 + manifest[file.name] = file.path;
589 + return manifest;
590 + }, seed);
591 + const entrypointFiles = entrypoints.main.filter(
592 + fileName => !fileName.endsWith('.map')
593 + );
594 +
595 + return {
596 + files: manifestFiles,
597 + entrypoints: entrypointFiles,
598 + };
599 + },
600 + }),
601 + // Moment.js is an extremely popular library that bundles large locale files
602 + // by default due to how webpack interprets its code. This is a practical
603 + // solution that requires the user to opt into importing specific locales.
604 + // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
605 + // You can remove this if you don't use Moment.js:
606 + new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
607 + // Generate a service worker script that will precache, and keep up to date,
608 + // the HTML & assets that are part of the webpack build.
609 + isEnvProduction &&
610 + new WorkboxWebpackPlugin.GenerateSW({
611 + clientsClaim: true,
612 + exclude: [/\.map$/, /asset-manifest\.json$/],
613 + importWorkboxFrom: 'cdn',
614 + navigateFallback: paths.publicUrlOrPath + 'index.html',
615 + navigateFallbackBlacklist: [
616 + // Exclude URLs starting with /_, as they're likely an API call
617 + new RegExp('^/_'),
618 + // Exclude any URLs whose last part seems to be a file extension
619 + // as they're likely a resource and not a SPA route.
620 + // URLs containing a "?" character won't be blacklisted as they're likely
621 + // a route with query params (e.g. auth callbacks).
622 + new RegExp('/[^/?]+\\.[^/]+$'),
623 + ],
624 + }),
625 + // TypeScript type checking
626 + useTypeScript &&
627 + new ForkTsCheckerWebpackPlugin({
628 + typescript: resolve.sync('typescript', {
629 + basedir: paths.appNodeModules,
630 + }),
631 + async: isEnvDevelopment,
632 + useTypescriptIncrementalApi: true,
633 + checkSyntacticErrors: true,
634 + resolveModuleNameModule: process.versions.pnp
635 + ? `${__dirname}/pnpTs.js`
636 + : undefined,
637 + resolveTypeReferenceDirectiveModule: process.versions.pnp
638 + ? `${__dirname}/pnpTs.js`
639 + : undefined,
640 + tsconfig: paths.appTsConfig,
641 + reportFiles: [
642 + '**',
643 + '!**/__tests__/**',
644 + '!**/?(*.)(spec|test).*',
645 + '!**/src/setupProxy.*',
646 + '!**/src/setupTests.*',
647 + ],
648 + silent: true,
649 + // The formatter is invoked directly in WebpackDevServerUtils during development
650 + formatter: isEnvProduction ? typescriptFormatter : undefined,
651 + }),
652 + ].filter(Boolean),
653 + // Some libraries import Node modules but don't use them in the browser.
654 + // Tell webpack to provide empty mocks for them so importing them works.
655 + node: {
656 + module: 'empty',
657 + dgram: 'empty',
658 + dns: 'mock',
659 + fs: 'empty',
660 + http2: 'empty',
661 + net: 'empty',
662 + tls: 'empty',
663 + child_process: 'empty',
664 + },
665 + // Turn off performance processing because we utilize
666 + // our own hints via the FileSizeReporter
667 + performance: false,
668 + };
669 +};
1 +'use strict';
2 +
3 +const fs = require('fs');
4 +const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
5 +const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
6 +const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
7 +const ignoredFiles = require('react-dev-utils/ignoredFiles');
8 +const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
9 +const paths = require('./paths');
10 +const getHttpsConfig = require('./getHttpsConfig');
11 +
12 +const host = process.env.HOST || '0.0.0.0';
13 +const sockHost = process.env.WDS_SOCKET_HOST;
14 +const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node'
15 +const sockPort = process.env.WDS_SOCKET_PORT;
16 +
17 +module.exports = function(proxy, allowedHost) {
18 + return {
19 + // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
20 + // websites from potentially accessing local content through DNS rebinding:
21 + // https://github.com/webpack/webpack-dev-server/issues/887
22 + // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
23 + // However, it made several existing use cases such as development in cloud
24 + // environment or subdomains in development significantly more complicated:
25 + // https://github.com/facebook/create-react-app/issues/2271
26 + // https://github.com/facebook/create-react-app/issues/2233
27 + // While we're investigating better solutions, for now we will take a
28 + // compromise. Since our WDS configuration only serves files in the `public`
29 + // folder we won't consider accessing them a vulnerability. However, if you
30 + // use the `proxy` feature, it gets more dangerous because it can expose
31 + // remote code execution vulnerabilities in backends like Django and Rails.
32 + // So we will disable the host check normally, but enable it if you have
33 + // specified the `proxy` setting. Finally, we let you override it if you
34 + // really know what you're doing with a special environment variable.
35 + disableHostCheck:
36 + !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
37 + // Enable gzip compression of generated files.
38 + compress: true,
39 + // Silence WebpackDevServer's own logs since they're generally not useful.
40 + // It will still show compile warnings and errors with this setting.
41 + clientLogLevel: 'none',
42 + // By default WebpackDevServer serves physical files from current directory
43 + // in addition to all the virtual build products that it serves from memory.
44 + // This is confusing because those files won’t automatically be available in
45 + // production build folder unless we copy them. However, copying the whole
46 + // project directory is dangerous because we may expose sensitive files.
47 + // Instead, we establish a convention that only files in `public` directory
48 + // get served. Our build script will copy `public` into the `build` folder.
49 + // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
50 + // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
51 + // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
52 + // Note that we only recommend to use `public` folder as an escape hatch
53 + // for files like `favicon.ico`, `manifest.json`, and libraries that are
54 + // for some reason broken when imported through webpack. If you just want to
55 + // use an image, put it in `src` and `import` it from JavaScript instead.
56 + contentBase: paths.appPublic,
57 + contentBasePublicPath: paths.publicUrlOrPath,
58 + // By default files from `contentBase` will not trigger a page reload.
59 + watchContentBase: true,
60 + // Enable hot reloading server. It will provide WDS_SOCKET_PATH endpoint
61 + // for the WebpackDevServer client so it can learn when the files were
62 + // updated. The WebpackDevServer client is included as an entry point
63 + // in the webpack development configuration. Note that only changes
64 + // to CSS are currently hot reloaded. JS changes will refresh the browser.
65 + hot: true,
66 + // Use 'ws' instead of 'sockjs-node' on server since we're using native
67 + // websockets in `webpackHotDevClient`.
68 + transportMode: 'ws',
69 + // Prevent a WS client from getting injected as we're already including
70 + // `webpackHotDevClient`.
71 + injectClient: false,
72 + // Enable custom sockjs pathname for websocket connection to hot reloading server.
73 + // Enable custom sockjs hostname, pathname and port for websocket connection
74 + // to hot reloading server.
75 + sockHost,
76 + sockPath,
77 + sockPort,
78 + // It is important to tell WebpackDevServer to use the same "publicPath" path as
79 + // we specified in the webpack config. When homepage is '.', default to serving
80 + // from the root.
81 + // remove last slash so user can land on `/test` instead of `/test/`
82 + publicPath: paths.publicUrlOrPath.slice(0, -1),
83 + // WebpackDevServer is noisy by default so we emit custom message instead
84 + // by listening to the compiler events with `compiler.hooks[...].tap` calls above.
85 + quiet: true,
86 + // Reportedly, this avoids CPU overload on some systems.
87 + // https://github.com/facebook/create-react-app/issues/293
88 + // src/node_modules is not ignored to support absolute imports
89 + // https://github.com/facebook/create-react-app/issues/1065
90 + watchOptions: {
91 + ignored: ignoredFiles(paths.appSrc),
92 + },
93 + https: getHttpsConfig(),
94 + host,
95 + overlay: false,
96 + historyApiFallback: {
97 + // Paths with dots should still use the history fallback.
98 + // See https://github.com/facebook/create-react-app/issues/387.
99 + disableDotRule: true,
100 + index: paths.publicUrlOrPath,
101 + },
102 + public: allowedHost,
103 + // `proxy` is run between `before` and `after` `webpack-dev-server` hooks
104 + proxy,
105 + before(app, server) {
106 + // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware`
107 + // middlewares before `redirectServedPath` otherwise will not have any effect
108 + // This lets us fetch source contents from webpack for the error overlay
109 + app.use(evalSourceMapMiddleware(server));
110 + // This lets us open files from the runtime error overlay.
111 + app.use(errorOverlayMiddleware());
112 +
113 + if (fs.existsSync(paths.proxySetup)) {
114 + // This registers user provided middleware for proxy reasons
115 + require(paths.proxySetup)(app);
116 + }
117 + },
118 + after(app) {
119 + // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
120 + app.use(redirectServedPath(paths.publicUrlOrPath));
121 +
122 + // This service worker file is effectively a 'no-op' that will reset any
123 + // previous service worker registered for the same host:port combination.
124 + // We do this in development to avoid hitting the production cache if
125 + // it used the same host and port.
126 + // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
127 + app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
128 + },
129 + };
130 +};
This diff could not be displayed because it is too large.
1 +{
2 + "name": "dfreact",
3 + "version": "0.1.0",
4 + "private": true,
5 + "dependencies": {
6 + "@babel/core": "7.9.0",
7 + "@svgr/webpack": "4.3.3",
8 + "@testing-library/jest-dom": "^4.2.4",
9 + "@testing-library/react": "^9.3.2",
10 + "@testing-library/user-event": "^7.1.2",
11 + "@toast-ui/react-chart": "^1.0.2",
12 + "@typescript-eslint/eslint-plugin": "^2.10.0",
13 + "@typescript-eslint/parser": "^2.10.0",
14 + "axios": "^0.19.2",
15 + "babel-eslint": "10.1.0",
16 + "babel-jest": "^24.9.0",
17 + "babel-loader": "8.1.0",
18 + "babel-plugin-named-asset-import": "^0.3.6",
19 + "babel-preset-react-app": "^9.1.2",
20 + "bootstrap": "^4.5.0",
21 + "camelcase": "^5.3.1",
22 + "case-sensitive-paths-webpack-plugin": "2.3.0",
23 + "css-loader": "3.4.2",
24 + "dotenv": "8.2.0",
25 + "dotenv-expand": "5.1.0",
26 + "eslint": "^6.6.0",
27 + "eslint-config-react-app": "^5.2.1",
28 + "eslint-loader": "3.0.3",
29 + "eslint-plugin-flowtype": "4.6.0",
30 + "eslint-plugin-import": "2.20.1",
31 + "eslint-plugin-jsx-a11y": "6.2.3",
32 + "eslint-plugin-react": "7.19.0",
33 + "eslint-plugin-react-hooks": "^1.6.1",
34 + "express": "^4.17.1",
35 + "file-loader": "4.3.0",
36 + "fs-extra": "^8.1.0",
37 + "html-webpack-plugin": "4.0.0-beta.11",
38 + "identity-obj-proxy": "3.0.0",
39 + "jest": "24.9.0",
40 + "jest-environment-jsdom-fourteen": "1.0.1",
41 + "jest-resolve": "24.9.0",
42 + "jest-watch-typeahead": "0.4.2",
43 + "mdbreact": "^4.27.0",
44 + "mini-css-extract-plugin": "0.9.0",
45 + "mysql": "^2.18.1",
46 + "mysql2": "^2.1.0",
47 + "optimize-css-assets-webpack-plugin": "5.0.3",
48 + "path": "^0.12.7",
49 + "pnp-webpack-plugin": "1.6.4",
50 + "postcss-flexbugs-fixes": "4.1.0",
51 + "postcss-loader": "3.0.0",
52 + "postcss-normalize": "8.0.1",
53 + "postcss-preset-env": "6.7.0",
54 + "postcss-safe-parser": "4.0.1",
55 + "react": "^16.13.1",
56 + "react-app-polyfill": "^1.0.6",
57 + "react-bootstrap": "^1.0.1",
58 + "react-bootstrap-table": "^4.3.1",
59 + "react-dev-utils": "^10.2.1",
60 + "react-dom": "^16.13.1",
61 + "react-router-dom": "^5.2.0",
62 + "resolve": "1.15.0",
63 + "resolve-url-loader": "3.1.1",
64 + "sass-loader": "8.0.2",
65 + "semver": "6.3.0",
66 + "sequelize": "^5.21.10",
67 + "sequelize-auto": "^0.4.29",
68 + "style-loader": "0.23.1",
69 + "terser-webpack-plugin": "2.3.5",
70 + "ts-pnp": "1.1.6",
71 + "url-loader": "2.3.0",
72 + "webpack": "4.42.0",
73 + "webpack-dev-server": "3.10.3",
74 + "webpack-manifest-plugin": "2.2.0",
75 + "workbox-webpack-plugin": "4.3.1"
76 + },
77 + "scripts": {
78 + "start": "node scripts/start.js",
79 + "build": "node scripts/build.js",
80 + "server": "nodemon server/server.js",
81 + "dev": "concurrently \"nodemon server/server.js\" \"node scripts/start.js\"",
82 + "test": "node scripts/test.js"
83 + },
84 + "eslintConfig": {
85 + "extends": "react-app"
86 + },
87 + "browserslist": {
88 + "production": [
89 + ">0.2%",
90 + "not dead",
91 + "not op_mini all"
92 + ],
93 + "development": [
94 + "last 1 chrome version",
95 + "last 1 firefox version",
96 + "last 1 safari version"
97 + ]
98 + },
99 + "jest": {
100 + "roots": [
101 + "<rootDir>/src"
102 + ],
103 + "collectCoverageFrom": [
104 + "src/**/*.{js,jsx,ts,tsx}",
105 + "!src/**/*.d.ts"
106 + ],
107 + "setupFiles": [
108 + "react-app-polyfill/jsdom"
109 + ],
110 + "setupFilesAfterEnv": [
111 + "<rootDir>/src/setupTests.js"
112 + ],
113 + "testMatch": [
114 + "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
115 + "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
116 + ],
117 + "testEnvironment": "jest-environment-jsdom-fourteen",
118 + "transform": {
119 + "^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
120 + "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
121 + "^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
122 + },
123 + "transformIgnorePatterns": [
124 + "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
125 + "^.+\\.module\\.(css|sass|scss)$"
126 + ],
127 + "modulePaths": [],
128 + "moduleNameMapper": {
129 + "^react-native$": "react-native-web",
130 + "^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
131 + },
132 + "moduleFileExtensions": [
133 + "web.js",
134 + "js",
135 + "web.ts",
136 + "ts",
137 + "web.tsx",
138 + "tsx",
139 + "json",
140 + "web.jsx",
141 + "jsx",
142 + "node"
143 + ],
144 + "watchPlugins": [
145 + "jest-watch-typeahead/filename",
146 + "jest-watch-typeahead/testname"
147 + ]
148 + },
149 + "babel": {
150 + "presets": [
151 + "react-app"
152 + ]
153 + },
154 + "proxy": "http://localhost:4000",
155 + "devDependencies": {
156 + "concurrently": "^5.2.0",
157 + "nodemon": "^2.0.4"
158 + }
159 +}
1 +<!DOCTYPE html>
2 +<html lang="en">
3 + <head>
4 + <meta charset="utf-8" />
5 + <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6 + <meta name="viewport" content="width=device-width, initial-scale=1" />
7 + <meta name="theme-color" content="#000000" />
8 + <meta
9 + name="description"
10 + content="Web site created using create-react-app"
11 + />
12 + <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13 + <!--
14 + manifest.json provides metadata used when your web app is installed on a
15 + user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16 + -->
17 + <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18 + <!--
19 + Notice the use of %PUBLIC_URL% in the tags above.
20 + It will be replaced with the URL of the `public` folder during the build.
21 + Only files inside the `public` folder can be referenced from the HTML.
22 +
23 + Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24 + work correctly both with client-side routing and a non-root public URL.
25 + Learn how to configure a non-root public URL by running `npm run build`.
26 + -->
27 + <title>React App</title>
28 + </head>
29 + <body>
30 + <noscript>You need to enable JavaScript to run this app.</noscript>
31 + <div id="root"></div>
32 + <!--
33 + This HTML file is a template.
34 + If you open it directly in the browser, you will see an empty page.
35 +
36 + You can add webfonts, meta tags, or analytics to this file.
37 + The build step will place the bundled scripts into the <body> tag.
38 +
39 + To begin the development, run `npm start` or `yarn start`.
40 + To create a production bundle, use `npm run build` or `yarn build`.
41 + -->
42 + </body>
43 +</html>
1 +{
2 + "short_name": "React App",
3 + "name": "Create React App Sample",
4 + "icons": [
5 + {
6 + "src": "favicon.ico",
7 + "sizes": "64x64 32x32 24x24 16x16",
8 + "type": "image/x-icon"
9 + },
10 + {
11 + "src": "logo192.png",
12 + "type": "image/png",
13 + "sizes": "192x192"
14 + },
15 + {
16 + "src": "logo512.png",
17 + "type": "image/png",
18 + "sizes": "512x512"
19 + }
20 + ],
21 + "start_url": ".",
22 + "display": "standalone",
23 + "theme_color": "#000000",
24 + "background_color": "#ffffff"
25 +}
1 +# https://www.robotstxt.org/robotstxt.html
2 +User-agent: *
3 +Disallow:
1 +'use strict';
2 +
3 +// Do this as the first thing so that any code reading it knows the right env.
4 +process.env.BABEL_ENV = 'production';
5 +process.env.NODE_ENV = 'production';
6 +
7 +// Makes the script crash on unhandled rejections instead of silently
8 +// ignoring them. In the future, promise rejections that are not handled will
9 +// terminate the Node.js process with a non-zero exit code.
10 +process.on('unhandledRejection', err => {
11 + throw err;
12 +});
13 +
14 +// Ensure environment variables are read.
15 +require('../config/env');
16 +
17 +
18 +const path = require('path');
19 +const chalk = require('react-dev-utils/chalk');
20 +const fs = require('fs-extra');
21 +const webpack = require('webpack');
22 +const configFactory = require('../config/webpack.config');
23 +const paths = require('../config/paths');
24 +const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
25 +const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
26 +const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
27 +const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
28 +const printBuildError = require('react-dev-utils/printBuildError');
29 +
30 +const measureFileSizesBeforeBuild =
31 + FileSizeReporter.measureFileSizesBeforeBuild;
32 +const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
33 +const useYarn = fs.existsSync(paths.yarnLockFile);
34 +
35 +// These sizes are pretty large. We'll warn for bundles exceeding them.
36 +const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
37 +const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
38 +
39 +const isInteractive = process.stdout.isTTY;
40 +
41 +// Warn and crash if required files are missing
42 +if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
43 + process.exit(1);
44 +}
45 +
46 +// Generate configuration
47 +const config = configFactory('production');
48 +
49 +// We require that you explicitly set browsers and do not fall back to
50 +// browserslist defaults.
51 +const { checkBrowsers } = require('react-dev-utils/browsersHelper');
52 +checkBrowsers(paths.appPath, isInteractive)
53 + .then(() => {
54 + // First, read the current file sizes in build directory.
55 + // This lets us display how much they changed later.
56 + return measureFileSizesBeforeBuild(paths.appBuild);
57 + })
58 + .then(previousFileSizes => {
59 + // Remove all content but keep the directory so that
60 + // if you're in it, you don't end up in Trash
61 + fs.emptyDirSync(paths.appBuild);
62 + // Merge with the public folder
63 + copyPublicFolder();
64 + // Start the webpack build
65 + return build(previousFileSizes);
66 + })
67 + .then(
68 + ({ stats, previousFileSizes, warnings }) => {
69 + if (warnings.length) {
70 + console.log(chalk.yellow('Compiled with warnings.\n'));
71 + console.log(warnings.join('\n\n'));
72 + console.log(
73 + '\nSearch for the ' +
74 + chalk.underline(chalk.yellow('keywords')) +
75 + ' to learn more about each warning.'
76 + );
77 + console.log(
78 + 'To ignore, add ' +
79 + chalk.cyan('// eslint-disable-next-line') +
80 + ' to the line before.\n'
81 + );
82 + } else {
83 + console.log(chalk.green('Compiled successfully.\n'));
84 + }
85 +
86 + console.log('File sizes after gzip:\n');
87 + printFileSizesAfterBuild(
88 + stats,
89 + previousFileSizes,
90 + paths.appBuild,
91 + WARN_AFTER_BUNDLE_GZIP_SIZE,
92 + WARN_AFTER_CHUNK_GZIP_SIZE
93 + );
94 + console.log();
95 +
96 + const appPackage = require(paths.appPackageJson);
97 + const publicUrl = paths.publicUrlOrPath;
98 + const publicPath = config.output.publicPath;
99 + const buildFolder = path.relative(process.cwd(), paths.appBuild);
100 + printHostingInstructions(
101 + appPackage,
102 + publicUrl,
103 + publicPath,
104 + buildFolder,
105 + useYarn
106 + );
107 + },
108 + err => {
109 + const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
110 + if (tscCompileOnError) {
111 + console.log(
112 + chalk.yellow(
113 + 'Compiled with the following type errors (you may want to check these before deploying your app):\n'
114 + )
115 + );
116 + printBuildError(err);
117 + } else {
118 + console.log(chalk.red('Failed to compile.\n'));
119 + printBuildError(err);
120 + process.exit(1);
121 + }
122 + }
123 + )
124 + .catch(err => {
125 + if (err && err.message) {
126 + console.log(err.message);
127 + }
128 + process.exit(1);
129 + });
130 +
131 +// Create the production build and print the deployment instructions.
132 +function build(previousFileSizes) {
133 + // We used to support resolving modules according to `NODE_PATH`.
134 + // This now has been deprecated in favor of jsconfig/tsconfig.json
135 + // This lets you use absolute paths in imports inside large monorepos:
136 + if (process.env.NODE_PATH) {
137 + console.log(
138 + chalk.yellow(
139 + 'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
140 + )
141 + );
142 + console.log();
143 + }
144 +
145 + console.log('Creating an optimized production build...');
146 +
147 + const compiler = webpack(config);
148 + return new Promise((resolve, reject) => {
149 + compiler.run((err, stats) => {
150 + let messages;
151 + if (err) {
152 + if (!err.message) {
153 + return reject(err);
154 + }
155 +
156 + let errMessage = err.message;
157 +
158 + // Add additional information for postcss errors
159 + if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
160 + errMessage +=
161 + '\nCompileError: Begins at CSS selector ' +
162 + err['postcssNode'].selector;
163 + }
164 +
165 + messages = formatWebpackMessages({
166 + errors: [errMessage],
167 + warnings: [],
168 + });
169 + } else {
170 + messages = formatWebpackMessages(
171 + stats.toJson({ all: false, warnings: true, errors: true })
172 + );
173 + }
174 + if (messages.errors.length) {
175 + // Only keep the first error. Others are often indicative
176 + // of the same problem, but confuse the reader with noise.
177 + if (messages.errors.length > 1) {
178 + messages.errors.length = 1;
179 + }
180 + return reject(new Error(messages.errors.join('\n\n')));
181 + }
182 + if (
183 + process.env.CI &&
184 + (typeof process.env.CI !== 'string' ||
185 + process.env.CI.toLowerCase() !== 'false') &&
186 + messages.warnings.length
187 + ) {
188 + console.log(
189 + chalk.yellow(
190 + '\nTreating warnings as errors because process.env.CI = true.\n' +
191 + 'Most CI servers set it automatically.\n'
192 + )
193 + );
194 + return reject(new Error(messages.warnings.join('\n\n')));
195 + }
196 +
197 + return resolve({
198 + stats,
199 + previousFileSizes,
200 + warnings: messages.warnings,
201 + });
202 + });
203 + });
204 +}
205 +
206 +function copyPublicFolder() {
207 + fs.copySync(paths.appPublic, paths.appBuild, {
208 + dereference: true,
209 + filter: file => file !== paths.appHtml,
210 + });
211 +}
1 +'use strict';
2 +
3 +// Do this as the first thing so that any code reading it knows the right env.
4 +process.env.BABEL_ENV = 'development';
5 +process.env.NODE_ENV = 'development';
6 +
7 +// Makes the script crash on unhandled rejections instead of silently
8 +// ignoring them. In the future, promise rejections that are not handled will
9 +// terminate the Node.js process with a non-zero exit code.
10 +process.on('unhandledRejection', err => {
11 + throw err;
12 +});
13 +
14 +// Ensure environment variables are read.
15 +require('../config/env');
16 +
17 +
18 +const fs = require('fs');
19 +const chalk = require('react-dev-utils/chalk');
20 +const webpack = require('webpack');
21 +const WebpackDevServer = require('webpack-dev-server');
22 +const clearConsole = require('react-dev-utils/clearConsole');
23 +const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
24 +const {
25 + choosePort,
26 + createCompiler,
27 + prepareProxy,
28 + prepareUrls,
29 +} = require('react-dev-utils/WebpackDevServerUtils');
30 +const openBrowser = require('react-dev-utils/openBrowser');
31 +const paths = require('../config/paths');
32 +const configFactory = require('../config/webpack.config');
33 +const createDevServerConfig = require('../config/webpackDevServer.config');
34 +
35 +const useYarn = fs.existsSync(paths.yarnLockFile);
36 +const isInteractive = process.stdout.isTTY;
37 +
38 +// Warn and crash if required files are missing
39 +if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
40 + process.exit(1);
41 +}
42 +
43 +// Tools like Cloud9 rely on this.
44 +const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
45 +const HOST = process.env.HOST || '0.0.0.0';
46 +
47 +if (process.env.HOST) {
48 + console.log(
49 + chalk.cyan(
50 + `Attempting to bind to HOST environment variable: ${chalk.yellow(
51 + chalk.bold(process.env.HOST)
52 + )}`
53 + )
54 + );
55 + console.log(
56 + `If this was unintentional, check that you haven't mistakenly set it in your shell.`
57 + );
58 + console.log(
59 + `Learn more here: ${chalk.yellow('https://bit.ly/CRA-advanced-config')}`
60 + );
61 + console.log();
62 +}
63 +
64 +// We require that you explicitly set browsers and do not fall back to
65 +// browserslist defaults.
66 +const { checkBrowsers } = require('react-dev-utils/browsersHelper');
67 +checkBrowsers(paths.appPath, isInteractive)
68 + .then(() => {
69 + // We attempt to use the default port but if it is busy, we offer the user to
70 + // run on a different port. `choosePort()` Promise resolves to the next free port.
71 + return choosePort(HOST, DEFAULT_PORT);
72 + })
73 + .then(port => {
74 + if (port == null) {
75 + // We have not found a port.
76 + return;
77 + }
78 +
79 + const config = configFactory('development');
80 + const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
81 + const appName = require(paths.appPackageJson).name;
82 + const useTypeScript = fs.existsSync(paths.appTsConfig);
83 + const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
84 + const urls = prepareUrls(
85 + protocol,
86 + HOST,
87 + port,
88 + paths.publicUrlOrPath.slice(0, -1)
89 + );
90 + const devSocket = {
91 + warnings: warnings =>
92 + devServer.sockWrite(devServer.sockets, 'warnings', warnings),
93 + errors: errors =>
94 + devServer.sockWrite(devServer.sockets, 'errors', errors),
95 + };
96 + // Create a webpack compiler that is configured with custom messages.
97 + const compiler = createCompiler({
98 + appName,
99 + config,
100 + devSocket,
101 + urls,
102 + useYarn,
103 + useTypeScript,
104 + tscCompileOnError,
105 + webpack,
106 + });
107 + // Load proxy config
108 + const proxySetting = require(paths.appPackageJson).proxy;
109 + const proxyConfig = prepareProxy(
110 + proxySetting,
111 + paths.appPublic,
112 + paths.publicUrlOrPath
113 + );
114 + // Serve webpack assets generated by the compiler over a web server.
115 + const serverConfig = createDevServerConfig(
116 + proxyConfig,
117 + urls.lanUrlForConfig
118 + );
119 + const devServer = new WebpackDevServer(compiler, serverConfig);
120 + // Launch WebpackDevServer.
121 + devServer.listen(port, HOST, err => {
122 + if (err) {
123 + return console.log(err);
124 + }
125 + if (isInteractive) {
126 + clearConsole();
127 + }
128 +
129 + // We used to support resolving modules according to `NODE_PATH`.
130 + // This now has been deprecated in favor of jsconfig/tsconfig.json
131 + // This lets you use absolute paths in imports inside large monorepos:
132 + if (process.env.NODE_PATH) {
133 + console.log(
134 + chalk.yellow(
135 + 'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
136 + )
137 + );
138 + console.log();
139 + }
140 +
141 + console.log(chalk.cyan('Starting the development server...\n'));
142 + openBrowser(urls.localUrlForBrowser);
143 + });
144 +
145 + ['SIGINT', 'SIGTERM'].forEach(function(sig) {
146 + process.on(sig, function() {
147 + devServer.close();
148 + process.exit();
149 + });
150 + });
151 +
152 + if (isInteractive || process.env.CI !== 'true') {
153 + // Gracefully exit when stdin ends
154 + process.stdin.on('end', function() {
155 + devServer.close();
156 + process.exit();
157 + });
158 + process.stdin.resume();
159 + }
160 + })
161 + .catch(err => {
162 + if (err && err.message) {
163 + console.log(err.message);
164 + }
165 + process.exit(1);
166 + });
1 +'use strict';
2 +
3 +// Do this as the first thing so that any code reading it knows the right env.
4 +process.env.BABEL_ENV = 'test';
5 +process.env.NODE_ENV = 'test';
6 +process.env.PUBLIC_URL = '';
7 +
8 +// Makes the script crash on unhandled rejections instead of silently
9 +// ignoring them. In the future, promise rejections that are not handled will
10 +// terminate the Node.js process with a non-zero exit code.
11 +process.on('unhandledRejection', err => {
12 + throw err;
13 +});
14 +
15 +// Ensure environment variables are read.
16 +require('../config/env');
17 +
18 +
19 +const jest = require('jest');
20 +const execSync = require('child_process').execSync;
21 +let argv = process.argv.slice(2);
22 +
23 +function isInGitRepository() {
24 + try {
25 + execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
26 + return true;
27 + } catch (e) {
28 + return false;
29 + }
30 +}
31 +
32 +function isInMercurialRepository() {
33 + try {
34 + execSync('hg --cwd . root', { stdio: 'ignore' });
35 + return true;
36 + } catch (e) {
37 + return false;
38 + }
39 +}
40 +
41 +// Watch unless on CI or explicitly running all tests
42 +if (
43 + !process.env.CI &&
44 + argv.indexOf('--watchAll') === -1 &&
45 + argv.indexOf('--watchAll=false') === -1
46 +) {
47 + // https://github.com/facebook/create-react-app/issues/5210
48 + const hasSourceControl = isInGitRepository() || isInMercurialRepository();
49 + argv.push(hasSourceControl ? '--watch' : '--watchAll');
50 +}
51 +
52 +
53 +jest.run(argv);
1 +const mysql = require('mysql');
2 +
3 +const db = mysql.createPool({
4 + host: 'localhost',
5 + port: '3307',
6 + user: 'root',
7 + password: 'yj',
8 + database: 'projectdf'
9 +});
10 +
11 +module.exports = db;
...\ No newline at end of file ...\ No newline at end of file
1 +const express = require('express');
2 +const app = express();
3 +const PORT = process.env.PORT || 4000;
4 +
5 +const db = require('./config/db');
6 +
7 +
8 +app.get('/api/host', (req, res) => {
9 + res.send({ host : 'Rekrow' });
10 +})
11 +
12 +app.get('/api/home_most_epic', (req, res) => {
13 + db.query("SELECT * FROM (SELECT ROW_NUMBER() over(order by temp.value desc)NUM, PICTURE,NAME, VALUE FROM (SELECT itemId, count(itemId) AS VALUE, date(droped_at) FROM item_drop_exception WHERE date(droped_at) = DATE(NOW()) GROUP BY itemid) temp join item_exception ie ON ie.itemId = temp.itemid) t WHERE t.NUM <=5", (err, data) => {
14 + if(!err) {
15 + res.send(data);
16 + } else {
17 + console.log(err);
18 + res.send(err);
19 + }
20 + })
21 +})
22 +app.get('/api/home_most_channel', (req, res) => {
23 + db.query("SELECT * from(SELECT * , ROW_NUMBER() over(order by temp.value desc)NUM from(select channel_name, channel_number, count(itemId) AS VALUE FROM item_drop_exception WHERE date(droped_at) = DATE(NOW()) GROUP BY CHANNEL_Name, Channel_NUMBER) temp) t WHERE num<=5",
24 + (err, data) => {
25 + if(!err) {
26 + res.send(data);
27 + } else {
28 + console.log(err);
29 + res.send(err);
30 + }
31 + })
32 +})
33 +
34 +app.get('/api/most_channel', (req, res) => {
35 + db.query("SELECT channel_name, channel_number, count(itemId) AS VALUE, ROW_NUMBER() OVER (ORDER BY value desc) as NUM FROM item_drop_exception WHERE date(droped_at) = DATE(NOW()) GROUP BY CHANNEL_Name, Channel_NUMBER order BY VALUE desc",
36 + (err, data) => {
37 + if(!err) {
38 + res.send(data);
39 + } else {
40 + console.log(err);
41 + res.send(err);
42 + }
43 + })
44 +})
45 +app.get('/api/week_most_channel', (req, res) => {
46 + db.query("SELECT *, ROW_NUMBER() OVER (ORDER BY T.value desc) as NUM FROM(SELECT channel_name, channel_number,COUNT(id) AS VALUE FROM item_drop_exception WHERE droped_at BETWEEN DATE_ADD(NOW(),INTERVAL - 1 week) AND NOW() GROUP BY CHANNEL_NAME, CHANNEL_NUMBER) T",
47 + (err, data) => {
48 + if(!err) {
49 + res.send(data);
50 + } else {
51 + console.log(err);
52 + res.send(err);
53 + }
54 + })
55 +})
56 +
57 +app.get('/api/most_epic', (req, res) => {
58 + db.query("SELECT NAME, PICTURE,VALUE, ROW_NUMBER() OVER (ORDER BY value desc) as NUM FROM (SELECT itemId, count(itemId) AS VALUE, date(droped_at) FROM item_drop_exception WHERE date(droped_at) = DATE(NOW()) GROUP BY itemid) temp join item_exception ie ON ie.itemId = temp.itemid",
59 + (err, data) => {
60 + if(!err) {
61 + res.send(data);
62 + } else {
63 + console.log(err);
64 + res.send(err);
65 + }
66 + })
67 +})
68 +
69 +app.get('/api/week_most_epic', (req, res) => {
70 + db.query("SELECT NAME, PICTURE,VALUE, ROW_NUMBER() OVER (ORDER BY T.value desc) as NUM FROM(SELECT itemId, COUNT(itemId) AS VALUE FROM item_drop_exception WHERE droped_at BETWEEN DATE_ADD(NOW(),INTERVAL - 1 week) AND NOW() GROUP BY itemId) T JOIN item_exception i ON i.itemId = T.itemId",
71 + (err, data) => {
72 + if(!err) {
73 + res.send(data);
74 + } else {
75 + console.log(err);
76 + res.send(err);
77 + }
78 + })
79 +})
80 +
81 +//search data
82 +app.get('/api/search_data/:searchTag', (req, res) => {
83 + const searchTag = req.params.searchTag;
84 + //console.log(searchTag);
85 + res.json({searchTag});
86 +
87 +})
88 +
89 +app.get('/api/getImage/:searchName', (req, res) => {
90 + const searchName =req.params.searchName;
91 + let id;
92 + let valueSql = `SELECT itemId as keyValue, name, picture FROM item_exception WHERE NAME LIKE '${searchName}'`;
93 + db.query(valueSql,searchName,(err, data) => {
94 + if(!err) {
95 + res.send(data);
96 + } else {
97 + console.log(err);
98 + res.send(err);
99 + }
100 + })
101 +})
102 +
103 +
104 +app.get('/api/search_epic1/:searchName', (req, res) => {
105 + const searchName =req.params.searchName;
106 + let id;
107 + let valueSql = `SELECT itemId as keyValue FROM item_exception WHERE NAME LIKE '${searchName}'`;
108 + db.query(valueSql,searchName,(err, data) => {
109 + if(!err) {
110 + id = data[0].keyValue;
111 + let resultSql =`SELECT T.channel_name, T.channel_number, T.VALUE, T.num from(SELECT itemId, channel_name, channel_number, COUNT(*) AS VALUE, ROW_NUMBER() over(order by value DESC) NUM FROM item_drop_exception WHERE itemId = (SELECT itemId FROM item_exception WHERE itemid = '${id}') AND date(droped_at) = DATE(NOW()) GROUP BY channel_name, channel_number) T WHERE T.NUM<=5 ORDER BY T.NUM`
112 + //console.log("id: "+ id);
113 + db.query( resultSql,id,(err, data) => {
114 + if(!err) {
115 + //console.log("data : " + data)
116 + res.send(data);
117 + } else {
118 + //console.log(err);
119 + res.send(err);
120 + }
121 + })
122 + } else {
123 + //console.log(err);
124 + res.send(err);
125 + }
126 + })
127 +})
128 +
129 +//원그래프 용 쿼리
130 +app.get('/api/search_epic2/:searchName', (req, res) => {
131 + const searchName =req.params.searchName;
132 + let id;
133 + let valueSql = `SELECT itemId as keyValue FROM item_exception WHERE NAME LIKE '${searchName}'`;
134 + db.query(valueSql,searchName,(err, data) => {
135 + if(!err) {
136 + id=data[0].keyValue;
137 + console.log("dataLog2: "+ JSON.stringify(data))
138 + var resultSql =`SELECT T.channel_name, T.channel_number, T.VALUE, T.num from(SELECT itemId, channel_name, channel_number, COUNT(*) AS VALUE, ROW_NUMBER() over(order by value DESC) NUM FROM item_drop_exception WHERE itemId = (SELECT itemId FROM item_exception WHERE itemid = '${id}') AND date(droped_at) = DATE(NOW()) GROUP BY channel_name, channel_number) T WHERE T.NUM<=7 ORDER BY T.NUM`
139 + db.query( resultSql,id,(err, data) => {
140 + if(!err) {
141 + res.send(data);
142 + } else {
143 + console.log(err);
144 + res.send(err);
145 + }
146 + })
147 + } else {
148 + //console.log(err);
149 + res.send(err);
150 + }
151 + })
152 +
153 +})
154 +
155 +app.get('/api/search_epic3/:searchName', (req, res) => {
156 + const searchName =req.params.searchName;
157 + var id;
158 + var i =0;
159 + var list1 = [];
160 + var valueSql = `SELECT itemId as keyValue FROM item_exception WHERE NAME LIKE '${searchName}'`;
161 + db.query(valueSql,searchName,(err, data) => {
162 + if(!err) {
163 + id=data[0].keyValue;
164 + //반복문으로 진행?
165 + while(i<7)
166 + {
167 + //console.log("iterator: "+i)
168 + var resultSql1 =`SELECT T.channel_name, T.channel_number, T.VALUE, T.num from(SELECT itemId, channel_name, channel_number, COUNT(*) AS VALUE, ROW_NUMBER() over(order by value DESC) NUM FROM item_drop_exception WHERE itemId = (SELECT itemId FROM item_exception WHERE itemid = '${id}') AND date(droped_at) = date(date_add(now(),interval -${i} DAY)) GROUP BY channel_name, channel_number) T WHERE T.NUM<=3 ORDER BY T.num`
169 + db.query( resultSql1,id,(err, result) => {
170 + if(!err) {
171 + list1.push(result);
172 + console.log(i+"번째 리스트 push, 내용: "+JSON.stringify(result));
173 +
174 + if(list1.length==7)
175 + {
176 + res.send(list1);
177 + }
178 + }
179 + else {
180 + // console.log(err);
181 + res.send(err);
182 + }
183 + })
184 + i++;
185 + }
186 + } else {
187 + console.log(err);
188 + res.send(err);
189 + }
190 + })
191 +})
192 +
193 +
194 +app.listen(PORT, () => {
195 + console.log(`Server On : http://localhost:${PORT}/`);
196 +})
197 +
198 +
199 +
1 +@charset "utf-8";
2 +@import url('https://fonts.googleapis.com/css?family=Nanum+Gothic');
3 +
4 +
5 +*{
6 + margin:0 auto;
7 + text-align: center;
8 + padding: 0;
9 +}
10 +
11 +.active-cyan-4 input[type=text]:focus:not([readonly]) {
12 + border: 1px solid #1ABC9C;
13 + box-shadow: 0 0 0 1px #1ABC9C;
14 + width: 60%;
15 + margin: auto;
16 +}
17 +.active-cyan-4 input[type=text] {
18 + width: 60%;
19 + margin: auto;
20 +}
21 +
22 +body{
23 + font: 22px 'Nanum Gothic', sans-serif;
24 +}
25 +
26 +a{
27 + text-decoration: none;
28 + color: #404040;
29 +}
30 +
31 +li{
32 + list-style: none;
33 +}
34 +#menu{ /*백그라운드 컬러만 지정*/
35 + padding-top: 5px;
36 + padding-bottom: 5px;
37 + font: 20px 'Nanum Gothic', sans-serif;
38 + background: #1ABC9C;
39 +
40 +}
41 +
42 +#menu ul{
43 + width:100%;
44 + height:70%;
45 + margin: 0 auto;
46 + overflow: hidden;
47 +}
48 +#menu ul li{
49 + float: left;
50 + width: 25%;
51 + line-height: 50px;
52 + text-align: center;
53 + background: #1ABC9C;
54 +
55 +}
56 +
57 +#menu ul li a{
58 + display:block;
59 + font-weight: 500;
60 + color: rgba(255,255,255,0.6);
61 + text-decoration: "none";
62 +}
63 +
64 +#menu ul li a:hover{
65 + text-decoration: "none";
66 + background: rgb(21, 150, 124);
67 + font-weight: bold;
68 + color: #fff;
69 +}
70 +
71 +
72 +
73 +.App {
74 + text-align: center;
75 +}
76 +
77 +.App-logo {
78 + height: 40vmin;
79 + pointer-events: none;
80 +}
81 +@media (prefers-reduced-motion: no-preference) {
82 + .App-logo {
83 + animation: App-logo-spin infinite 20s linear;
84 + }
85 +}
86 +.App-header {
87 + background-color: #282c34;
88 + min-height: 100vh;
89 + display: flex;
90 + flex-direction: column;
91 + align-items: center;
92 + justify-content: center;
93 + font-size: calc(10px + 2vmin);
94 + color: white;
95 +}
96 +.App-link {
97 + color: #61dafb;
98 +}
99 +@keyframes App-logo-spin {
100 + from {
101 + transform: rotate(0deg);
102 + }
103 + to {
104 + transform: rotate(360deg);
105 + }
106 +}
1 +/* src/app.js */
2 +
3 +import ReactDOM from 'react-dom';
4 +import { Route, BrowserRouter, Switch, Link, useHistory} from 'react-router-dom';
5 +import React, { Component } from 'react';
6 +import Home from './home';
7 +//import {navigate} from "@reach/router"
8 +
9 +
10 +import TodayChannel from './TodayChannel';
11 +import TodayEpic from './TodayEpic';
12 +import WeekChannel from './WeekChannel';
13 +import WeekEpic from './WeekEpic'
14 +import Search from './Search'
15 +import App2 from './App2'
16 +
17 +
18 +import './App.css'
19 +import axios from 'axios';
20 +
21 +const TestPage = ({data}) => {
22 + const history = useHistory();
23 + React.useEffect(()=>{
24 + console.log(data)
25 + if(data.length > 0)
26 + history.push('/searchList/result')
27 + }, [data])
28 + return (
29 +<></>
30 + )
31 +}
32 +
33 +
34 +
35 +class App extends Component {
36 +
37 + constructor(props) {
38 + super(props)
39 + this.state = {
40 + searchList: [], //검색 결과
41 + screenWidth: 0, //보여지는 윈도우 가로길이
42 + }
43 + }
44 +
45 +
46 + onKeyDownMethod = async(e)=>
47 + {
48 + if(e.keyCode===13)//엔터 입력시
49 + {
50 + const searchTag = document.querySelector("#searchInput").value;
51 + const res = await axios.get(`/api/search_data/${searchTag}`);
52 + console.log(res.data);
53 + this.setState({searchList: [res.data]})
54 + }
55 + }
56 +
57 +
58 + render() {
59 + const sStyle={
60 + margin: "0 auto",
61 + }
62 + const lStyle ={
63 + color: "black",
64 + top: "30px",
65 + height: "100%",
66 + fontSize: "50px",
67 + fontWeight: "bold",
68 + color: "black",
69 + textDecoration: "none",
70 + }
71 + return (
72 + <BrowserRouter>
73 + <div>
74 + <div style={{height: "50px"}}></div>
75 + <div id = "menu">
76 + <ul>
77 + <li><Link to='/todayEpic'>오늘 가장 많이 나온 에픽</Link></li>
78 + <li><Link to='/todayChannel'>오늘 가장 많이 나온 채널</Link></li>
79 + <li><Link to='/WeekEpic'>지난 1주간 가장 많이 나온 에픽</Link></li>
80 + <li><Link to='/WeekChannel'>지난 1주간 가장 많이 나온 채널</Link></li>
81 + {/* <li><Link to='/searchList'>테스트</Link></li>*/}
82 + </ul>
83 + </div>
84 + <TestPage data={this.state.searchList} />
85 + <div style={{height: "50px"}}></div>
86 + <div id ="HomeLogo">
87 + <Link style={lStyle}to='/'>D&F Epic</Link>
88 + </div>
89 + <div style={{height: "50px"}}></div>
90 + <div class="active-cyan-4">
91 + <input id="searchInput" onKeyDown={this.onKeyDownMethod} class="form-control" type="text" placeholder="Search" aria-label="Search"/>
92 + </div>
93 + <div style={{height: "50px"}}></div>
94 + <Switch>
95 + <Route exact path='/'><Home></Home></Route>
96 + <Route path='/todayChannel'><TodayChannel></TodayChannel></Route>
97 + <Route path='/todayEpic'><TodayEpic></TodayEpic></Route>
98 + <Route path='/WeekEpic'><WeekEpic></WeekEpic></Route>
99 + <Route path='/WeekChannel'><WeekChannel></WeekChannel></Route>
100 + {/*<Route exact path='/searchList'><App2 searchList={this.state.searchList}></App2></Route>*/}
101 + <Route path='/searchList/result'><Search searchList={this.state.searchList}></Search></Route>
102 + <Route path ='/'>Not Found</Route>
103 + </Switch>
104 + </div>
105 + </BrowserRouter>
106 + );
107 + }
108 +}
109 +
110 +ReactDOM.render(<BrowserRouter><App/></BrowserRouter>,document.getElementById('root'));
111 +
112 +export default App;
1 +import React from 'react';
2 +import { render } from '@testing-library/react';
3 +import App from './App';
4 +
5 +test('renders learn react link', () => {
6 + const { getByText } = render(<App />);
7 + const linkElement = getByText(/learn react/i);
8 + expect(linkElement).toBeInTheDocument();
9 +});
1 +
2 +import React, { Component } from 'react';
3 +import './App.css';
4 +import axios from 'axios';
5 +import 'bootstrap/dist/css/bootstrap.min.css';
6 +import 'tui-chart/dist/tui-chart.css'
7 +import {ColumnChart} from '@toast-ui/react-chart'
8 +
9 +
10 +const data = {
11 + categories: ['월', '화','수', '목', '금','토','일'],
12 + series: [
13 + {
14 + name: ['심연 1채'],
15 + data: [20, 15, 50, 7, 40, 40,100]
16 + },
17 + {
18 + name: '2위',
19 + data: [8, 10, 7, 20, 50, 30,80]
20 + },
21 + {
22 + name: '3위',
23 + data: [20, 15, 50, 7, 40, 40,4]
24 + },
25 + {
26 + name: '4위',
27 + data: [8, 10, 7, 20, 50, 30,5]
28 + }
29 + ]
30 +};
31 +
32 +const options = {
33 + chart: {
34 + width: 1160,
35 + height: 650,
36 + title: 'Monthly Revenue',
37 + format: '1,000'
38 + },
39 + yAxis: {
40 + title: '아이템 드롭 갯수',
41 + min: 0,
42 + max: 100,
43 + suffix: '개'
44 + },
45 + xAxis: {
46 + title: '날짜',
47 + },
48 + series: {
49 + showLabel: true
50 + },
51 + legend: {
52 + align: 'top'
53 + }
54 +};
55 +
56 +class App2 extends Component{
57 + constructor(props) {
58 + super(props)
59 + this.state = {
60 + host : '',
61 + searchList: this.props.searchList,
62 + myEpicData: [],
63 + myChannelData: [],
64 + screenWidth: 0, //보여지는 윈도우 가로길이
65 + }
66 + }
67 + componentDidUpdate(){
68 + }
69 + render() {
70 + return(
71 + <div>
72 + </div>
73 + );
74 + }
75 +}
76 +
77 +export default App2;
...\ No newline at end of file ...\ No newline at end of file
1 +
2 +import React, { Component } from 'react';
3 +import './App.css';
4 +import axios from 'axios';
5 +import 'bootstrap/dist/css/bootstrap.min.css';
6 +import * as ReactBootStrap from "react-bootstrap";
7 +import {PieChart,ColumnChart} from '@toast-ui/react-chart'
8 +
9 +let today = new Date();
10 +let date = today.getDate();// 요일
11 +
12 +
13 +let count =0;
14 +let controll =1;
15 +
16 +let swit = 0;
17 +let test = [];
18 +let testV =[];
19 +
20 +let coltest=[];
21 +let coltestV=[];
22 +
23 +
24 +
25 +
26 +let tdata ={
27 + categories:['채널 이름'],
28 + series:[]
29 +};
30 +
31 +let colData1 ={
32 + categories:[String(date+'일')],
33 + series:[]
34 +};
35 +let colData2 ={
36 + categories:[String(date-1+'일')],
37 + series:[]
38 +};
39 +let colData3 ={
40 + categories:[String(date-2+'일')],
41 + series:[]
42 +};
43 +let colData4 ={
44 + categories:[String(date-3+'일')],
45 + series:[]
46 +};
47 +let colData5 ={
48 + categories:[String(date-4+'일')],
49 + series:[]
50 +};
51 +let colData6 ={
52 + categories:[String(date-5+'일')],
53 + series:[]
54 +};
55 +let colData7 ={
56 + categories:[String(date-6+'일')],
57 + series:[]
58 +};
59 +
60 +
61 +const tdataPush = (test1,test2,result) =>
62 +{
63 + let tSeries =[]
64 + result.series =[];
65 + for(let i =0;i<test1.length;i++)
66 + {
67 + tSeries.push({name: String(test1[i]), data: Number(test2[i])})
68 + }
69 + result.series=tSeries;
70 + console.log("tdata: "+JSON.stringify(result));
71 + console.log("tdata: "+JSON.stringify(result.series[0]));
72 + swit++;
73 +}
74 +const colDataPush = (test1,test2,result) =>
75 +{
76 + let tSeries =[]
77 + result.series =[];
78 + for(let i = count ;(i<(controll*3))&&(count<22);i++)
79 + {
80 + // console.log("coldata: "+JSON.stringify(test2[i]));
81 + console.log("count: "+count);
82 + console.log("controll: "+controll+" & "+controll*3);
83 +
84 + tSeries.push({name: String(test1[i]), data: Number(test2[i])})
85 + count++;
86 + }
87 + controll++;
88 + console.log("count: "+count);
89 + result.series=tSeries;
90 + console.log("coldatag: "+JSON.stringify(result));
91 + console.log("coldataf: "+JSON.stringify(result.series[0]));
92 + swit++;
93 +}
94 +var theme = {
95 + series: {
96 + colors: [
97 + '#83b14e', '#458a3f', '#295ba0', '#2a4175', '#289399',
98 + '#289399', '#617178', '#8a9a9a', '#516f7d', '#dddddd'
99 + ]
100 + }
101 +};
102 +
103 +const renderChannelData = (data1, index) =>{
104 + return(
105 + <tr key = {index}>
106 + <td><img src={`/images/${data1.num}.jpg`} width="50px"></img></td>
107 + <td>{data1.channel_name} {data1.channel_number}</td>
108 + <td>{data1.VALUE}</td>
109 + </tr>
110 + )
111 +}
112 +
113 +const renderInfo = (data1, index) =>{
114 + return(
115 + <div>
116 + <img src={`/images/${data1.picture}.png`} width="50px"></img> {data1.name}
117 + </div>
118 + )
119 +}
120 +
121 +class Search extends Component{
122 + constructor(props) {
123 + super(props)
124 + this.state = {
125 + searchList: [{searchTag: ''}],
126 + searchID : '',
127 + EpicInfo:[],
128 + searchEpicData: [],
129 + searchDayChannelData: [],
130 + searchweekChannelData: [],
131 + colOptions:{
132 + chart: {
133 + width: 550,
134 + height: 550,
135 + format: '1,000'
136 + },
137 + yAxis: {
138 + title: '드랍 갯수',
139 + min: 0,
140 + max: 70
141 + },
142 + xAxis: {
143 + title: '드랍 채널 top 3'
144 + },
145 + legend: {
146 + align: 'top'
147 + }
148 + },
149 + cOptions:{
150 + chart: {
151 + width: 660,
152 + height: 560,
153 + title: '오늘의 드랍 채널(Top 7)'
154 + },
155 + tooltip: {
156 + suffix: '개'
157 + }
158 + },
159 + isFinish: false,
160 + screenWidth: 0, //보여지는 윈도우 가로길이
161 + }
162 + }
163 +
164 + _getImage= async(data) =>{
165 + const res = await axios.get(`/api/getImage/${data[0].searchTag}`);
166 + this.setState({EpicInfo: res.data})
167 + }
168 +
169 + _getSearch1 = async(data) => {//검색시 최상단 3~5개 채널 나오는 것
170 + console.log(data[0].searchTag)
171 + const res = await axios.get(`/api/search_epic1/${data[0].searchTag}`);
172 + this.setState({searchEpicData : res.data})
173 + //console.log("search:"+ JSON.stringify(this.state.searchEpicData))
174 + //console.log(this.state.myEpicData)
175 + }
176 +
177 + _getSearch2 = async(data) => {//검색시 나오는 원형 차트용 데이터
178 + swit=0;
179 + test =[];
180 + testV =[];
181 + const res = await axios.get(`/api/search_epic2/${data[0].searchTag}`);
182 + this.setState({searchDayChannelData : res.data})
183 + for(const dataObj of this.state.searchDayChannelData)
184 + {
185 + test.push(dataObj.channel_name+' '+dataObj.channel_number);
186 + testV.push(parseInt(dataObj.VALUE))
187 + }
188 + tdataPush(test,testV,tdata);
189 + }
190 +
191 + _getSearch3 = async(data) => {//검색시 나오는 막대 차트용 데이터
192 +
193 + coltest =[]; //[{3}{3} 3 3 3 3 3 ]
194 + coltestV =[];
195 + console.log("before colt: "+ JSON.stringify(coltest));
196 + console.log("before colv: "+ JSON.stringify(coltestV));
197 + this.setState({isFinish: false});
198 + const res = await axios.get(`/api/search_epic3/${data[0].searchTag}`);
199 + this.setState({searchweekChannelData : res.data})
200 + for(const dataObj of this.state.searchweekChannelData)
201 + {
202 + for(let i = 0; i< dataObj.length; i++)
203 + {
204 + coltest.push(dataObj[i].channel_name+' '+dataObj[i].channel_number);
205 + coltestV.push(parseInt(dataObj[i].VALUE));
206 + //console.log("dataOBJ "+i+": "+JSON.stringify(dataObj[i]))
207 + }
208 + }
209 +
210 + console.log("colt: "+ JSON.stringify(coltest));
211 + console.log("colv: "+ JSON.stringify(coltestV));
212 + controll=1; count =0;
213 +
214 + colData1.series=[];
215 + colData2.series=[];
216 + colData3.series=[];
217 + colData4.series=[];
218 + colData5.series=[];
219 + colData6.series=[];
220 + colData7.series=[];
221 + colDataPush(coltest,coltestV,colData1);
222 + console.log("c1"+colData1.series);
223 + colDataPush(coltest,coltestV,colData2);
224 + colDataPush(coltest,coltestV,colData3);
225 + colDataPush(coltest,coltestV,colData4);
226 + colDataPush(coltest,coltestV,colData5);
227 + colDataPush(coltest,coltestV,colData6);
228 + colDataPush(coltest,coltestV,colData7);
229 +
230 + this.setState({isFinish: true});
231 + }
232 +
233 + _getSearch4 = ()=>{ //검색시 나오는 세트용 데이터
234 +
235 + }
236 +
237 + componentDidMount() {
238 + try{
239 + if(this.state.searchList[0]!=this.props.searchList[0])
240 + {
241 + this.setState({searchList: this.props.searchList})
242 + this._getSearch1(this.props.searchList)
243 + this._getSearch2(this.props.searchList)
244 + this._getSearch3(this.props.searchList)
245 + this._getImage(this.props.searchList)
246 + }
247 + this._setWidth()
248 + }
249 + catch(e)
250 + {
251 + console.log(e)
252 + }
253 + }
254 +
255 + componentDidUpdate(){
256 + if(this.state.searchList[0]!=this.props.searchList[0])
257 + {
258 + this.setState({searchList: this.props.searchList})
259 + this._getSearch1(this.props.searchList)
260 + this._getSearch2(this.props.searchList)
261 + this._getSearch3(this.props.searchList)
262 + this._getImage(this.props.searchList)
263 + }
264 + }
265 +
266 + render() {
267 + const lStyle ={
268 + color: "black",
269 + top: "30px",
270 + height: "100%",
271 + fontSize: "50px",
272 + fontWeight: "bold",
273 + color: "black",
274 + textDecoration: "none",
275 + }
276 + if(this.state.isFinish)
277 + {
278 + return(
279 + <div>
280 + <h1>{this.state.EpicInfo.map(renderInfo)}</h1>
281 + <span>
282 + <ReactBootStrap.Table striped bordered hover>
283 + <thead>
284 + <tr>
285 + <th>순위</th>
286 + <th>채널</th>
287 + <th>나온 횟수</th>
288 + </tr>
289 + </thead>
290 + <tbody>
291 + {this.state.searchEpicData.map(renderChannelData)}
292 + </tbody>
293 + </ReactBootStrap.Table>
294 + </span>
295 + <div>
296 + <PieChart
297 + data={tdata}
298 + options={this.state.cOptions}
299 + />
300 + </div>
301 + <div>
302 + <div>
303 + <ColumnChart
304 + data={colData1}
305 + options={this.state.colOptions}
306 + />
307 + </div><div>
308 + <ColumnChart
309 + data={colData2}
310 + options={this.state.colOptions}
311 + />
312 + </div><div>
313 + <ColumnChart
314 + data={colData3}
315 + options={this.state.colOptions}
316 + />
317 + </div><div>
318 + <ColumnChart
319 + data={colData4}
320 + options={this.state.colOptions}
321 + />
322 + </div><div>
323 + <ColumnChart
324 + data={colData5}
325 + options={this.state.colOptions}
326 + /></div><div>
327 + <ColumnChart
328 + data={colData6}
329 + options={this.state.colOptions}
330 + /></div><div>
331 + <ColumnChart
332 + data={colData7}
333 + options={this.state.colOptions}
334 + /></div>
335 + </div>
336 + </div>
337 + );
338 + }
339 + else{
340 + return(<div>로딩중입니다.</div>);
341 + }
342 + }
343 +}
344 +
345 +export default Search;
...\ No newline at end of file ...\ No newline at end of file
1 +
2 +import React, { Component } from 'react';
3 +import './App.css';
4 +import axios from 'axios';
5 +import 'bootstrap/dist/css/bootstrap.min.css';
6 +import * as ReactBootStrap from "react-bootstrap";
7 +
8 +
9 +
10 +const renderChannelData = (data1, index) =>{
11 + return(
12 + <tr key = {index}>
13 + <td>{data1.NUM}</td>
14 + <td>{data1.channel_name} {data1.channel_number}</td>
15 + <td>{data1.VALUE}</td>
16 + </tr>
17 + )
18 +}
19 +
20 +
21 +class TodayChannel extends Component{
22 + constructor(props) {
23 + super(props)
24 + this.state = {
25 + host : '',
26 + myChannelData: [],
27 + }
28 + }
29 +
30 + _getMostChannel = async() => {
31 + const res = await axios.get('/api/most_channel');
32 + console.log(res.data)
33 + this.setState({myChannelData : res.data})
34 + console.log(this.state.myChannelData)
35 + }
36 +
37 + _getHost = async() => {
38 + const res = await axios.get('/api/host');
39 + console.log(res.data.host)
40 + this.setState({ host : res.data.host })
41 + }
42 +
43 + componentDidMount() {
44 + this._getHost();
45 + this._getMostChannel();
46 + }
47 +
48 + render() {
49 + return(
50 + this.state.myChannelData.length === 0 ? (<div>로딩중입니다.</div>):(
51 + <div>
52 + <br></br>
53 + <br></br>
54 + <br></br>
55 + <div className='todayChannel'>
56 + <div>
57 + <div>
58 + <br></br>
59 + <h3>오늘 에픽이 가장 많이 나온 채널</h3>
60 + </div>
61 + </div>
62 + </div>
63 + <div>
64 + <ReactBootStrap.Table striped bordered hover>
65 + <thead>
66 + <tr>
67 + <th>순위</th>
68 + <th>채널</th>
69 + <th>나온 횟수</th>
70 + </tr>
71 + </thead>
72 + <tbody>
73 + {this.state.myChannelData.map(renderChannelData)}
74 + </tbody>
75 + </ReactBootStrap.Table>
76 + </div>
77 + </div>)
78 + );
79 + }
80 +}
81 +
82 +export default TodayChannel;
...\ No newline at end of file ...\ No newline at end of file
1 +import React, { Component } from 'react';
2 +import 'bootstrap/dist/css/bootstrap.min.css';
3 +import * as ReactBootStrap from "react-bootstrap";
4 +import axios from 'axios';
5 +
6 +const renderEpicData = (data1, index) =>{
7 + return(
8 + <tr key = {index}>
9 + <td>{data1.NUM}</td>
10 + <td><img width="40%" src={`/images/${data1.PICTURE}.png`}></img></td>
11 + <td>{data1.NAME}</td>
12 + <td>{data1.VALUE}</td>
13 + </tr>
14 + )
15 +}
16 +
17 +class TodayEpic extends Component {
18 + constructor(props) {
19 + super(props)
20 + this.state = {
21 + host : '',
22 + myEpicData: [],
23 + }
24 + }
25 +
26 + componentDidMount() {
27 + this._getHost();
28 + this._getMostEpic();
29 + }
30 +
31 + _getMostEpic = async() => {
32 + const res = await axios.get('/api/most_epic');
33 + this.setState({myEpicData : res.data})
34 + }
35 +
36 + _getHost = async() => {
37 + const res = await axios.get('/api/host');
38 + this.setState({ host : res.data.host })
39 + }
40 +
41 + render() {
42 + return(
43 + this.state.myEpicData.length === 0? (<div>로딩중입니다.</div>):(
44 + <div>
45 + <br></br>
46 + <br></br>
47 + <br></br>
48 + <div className='todayEpic'>
49 + <h3>오늘 가장 많이 나온 에픽 아이템</h3>
50 + <div>
51 + <ReactBootStrap.Table striped bordered hover>
52 + <thead>
53 + <tr>
54 + <th>순위</th>
55 + <th colSpan='2'>에픽 아이템</th>
56 + <th>나온 횟수</th>
57 + </tr>
58 + </thead>
59 + <tbody>
60 + {this.state.myEpicData.map(renderEpicData)}
61 + </tbody>
62 + </ReactBootStrap.Table>
63 + </div>
64 + </div>
65 + </div>
66 + )
67 + );
68 + }
69 + }
70 +
71 + export default TodayEpic;
72 +
...\ No newline at end of file ...\ No newline at end of file
1 +
2 +import React, { Component } from 'react';
3 +import './App.css';
4 +import axios from 'axios';
5 +import 'bootstrap/dist/css/bootstrap.min.css';
6 +import * as ReactBootStrap from "react-bootstrap";
7 +
8 +const renderChannelData = (data1, index) =>{
9 + return(
10 + <tr key = {index}>
11 + <td>{data1.NUM}</td>
12 + <td>{data1.channel_name} {data1.channel_number}</td>
13 + <td>{data1.VALUE}</td>
14 + </tr>
15 + )
16 +}
17 +
18 +
19 +
20 +class WeekChannel extends Component{
21 + constructor(props) {
22 + super(props)
23 + this.state = {
24 + host : '',
25 + myChannelData: [],
26 + }
27 + }
28 +
29 + _getMostChannel = async() => {
30 + const res = await axios.get('/api/week_most_channel');
31 + this.setState({myChannelData : res.data})
32 + }
33 +
34 + _getHost = async() => {
35 + const res = await axios.get('/api/host');
36 + this.setState({ host : res.data.host })
37 + }
38 +
39 + componentDidMount() {
40 + this._getHost();
41 + this._getMostChannel();
42 + }
43 +
44 + render() {
45 + return(
46 + this.state.myChannelData.length === 0? (<div>로딩중입니다.</div>):(
47 + <div>
48 + <br></br>
49 + <br></br>
50 + <br></br>
51 + <div className='Home'>
52 + <div>
53 + <div>
54 + <br></br>
55 + <h3>지난 1주일간 에픽이 가장 많이 나온 채널</h3>
56 + </div>
57 + </div>
58 + </div>
59 + <div>
60 + <ReactBootStrap.Table striped bordered hover>
61 + <thead>
62 + <tr>
63 + <th>순위</th>
64 + <th>채널</th>
65 + <th>나온 횟수</th>
66 + </tr>
67 + </thead>
68 + <tbody>
69 + {this.state.myChannelData.map(renderChannelData)}
70 + </tbody>
71 + </ReactBootStrap.Table>
72 + </div>
73 + </div>
74 + )
75 + );
76 + }
77 +}
78 +
79 +export default WeekChannel;
...\ No newline at end of file ...\ No newline at end of file
1 +
2 +import React, { Component } from 'react';
3 +import './App.css';
4 +import axios from 'axios';
5 +import 'bootstrap/dist/css/bootstrap.min.css';
6 +import * as ReactBootStrap from "react-bootstrap";
7 +
8 +
9 +const renderEpicData = (data1, index) =>{
10 + return(
11 + <tr key = {index}>
12 + <td>{data1.NUM}</td>
13 + <td><img width="45%" src={`/images/${data1.PICTURE}.png`}></img></td>
14 + <td>{data1.NAME}</td>
15 + <td>{data1.VALUE}</td>
16 + </tr>
17 + )
18 +}
19 +
20 +
21 +class WeekEpic extends Component{
22 + constructor(props) {
23 + super(props)
24 + this.state = {
25 + host : '',
26 + myEpicData: [],
27 + }
28 + }
29 +
30 +
31 + _getMostEpic = async() => {
32 + const res = await axios.get('/api/week_most_epic');
33 + this.setState({myEpicData : res.data})
34 + }
35 +
36 + _getHost = async() => {
37 + const res = await axios.get('/api/host');
38 + this.setState({ host : res.data.host })
39 + }
40 +
41 + componentDidMount() {
42 + this._getHost();
43 + this._getMostEpic();
44 + }
45 +
46 + render() {
47 + return(
48 + this.state.myEpicData.length === 0? (<div>로딩중입니다.</div>):(
49 + <div>
50 + <br></br>
51 + <br></br>
52 + <br></br>
53 + <div className='Home'>
54 + <h3>지난 1주일간 가장 많이 나온 에픽 아이템</h3>
55 + <div>
56 + <ReactBootStrap.Table striped bordered hover>
57 + <thead>
58 + <tr>
59 + <th>순위</th>
60 + <th colSpan='2'>에픽 아이템</th>
61 + <th>나온 횟수</th>
62 + </tr>
63 + </thead>
64 + <tbody>
65 + {this.state.myEpicData.map(renderEpicData)}
66 + </tbody>
67 + </ReactBootStrap.Table>
68 + </div>
69 + </div>
70 + </div>
71 + )
72 + );
73 + }
74 +}
75 +
76 +export default WeekEpic;
...\ No newline at end of file ...\ No newline at end of file
1 +
2 +import React, { Component } from 'react';
3 +import './App.css';
4 +import axios from 'axios';
5 +import 'bootstrap/dist/css/bootstrap.min.css';
6 +import * as ReactBootStrap from "react-bootstrap";
7 +
8 +const renderChannelData = (data1, index) =>{
9 + return(
10 + <tr key = {index}>
11 + <td>{data1.NUM}</td>
12 + <td>{data1.channel_name} {data1.channel_number}</td>
13 + <td>{data1.VALUE}</td>
14 + </tr>
15 + )
16 +}
17 +
18 +const renderEpicData = (data1, index) =>{
19 + return(
20 + <tr key = {index}>
21 + <td>{data1.NUM}</td>
22 + <td><img src={`/images/${data1.PICTURE}.png`} width="80%"></img></td>
23 + <td> {data1.NAME}</td>
24 + <td>{data1.VALUE}</td>
25 + </tr>
26 + )
27 +}
28 +
29 +
30 +class Home extends Component{
31 + constructor(props) {
32 + super(props)
33 + this.state = {
34 + host : '',
35 + myEpicData: [],
36 + myChannelData: [],
37 + screenWidth: 0, //보여지는 윈도우 가로길이
38 + }
39 + }
40 +
41 +
42 + _getMostEpic = async() => {
43 + const res = await axios.get('/api/home_most_epic');
44 + console.log(res.data)
45 + this.setState({myEpicData : res.data})
46 + console.log(this.state.myEpicData)
47 + }
48 +
49 + _getMostChannel = async() => {
50 + const res = await axios.get('/api/home_most_channel');
51 + console.log(res.data)
52 + this.setState({myChannelData : res.data})
53 + console.log(this.state.myChannelData)
54 + }
55 +
56 + _getHost = async() => {
57 + const res = await axios.get('/api/host');
58 + console.log(res.data.host)
59 + this.setState({ host : res.data.host })
60 + }
61 +
62 + _setWidth = ()=>{
63 + this.setState({screenWidth: window.innerWidth})
64 + }
65 +
66 +
67 +
68 + componentDidMount() {
69 + try{
70 + this._getMostChannel()
71 + this._getMostEpic()
72 + this._setWidth()
73 + }
74 + catch(e)
75 + {
76 + console.log(e)
77 + }
78 + }
79 +
80 + componentDidUpdate(){
81 + }
82 +
83 +
84 +
85 + render() {
86 + return(
87 + this.state.myEpicData.length === 0 || this.state.myChannelData.length === 0 ? (<div>로딩중입니다.</div>):(
88 + <div>
89 + <br></br>
90 + <br></br>
91 + <br></br>
92 + <div className='Home' style={{textAilgn:"center"}}>
93 + <div style={{width: "500px", marginLeft: `${(this.state.screenWidth-1040)/2}px`, marginRight: "20px",float : "left"}}>
94 + <h3>오늘 가장 많이 나온 에픽 아이템</h3>
95 + <div>
96 + <ReactBootStrap.Table striped bordered hover>
97 + <thead>
98 + <tr>
99 + <th>순위</th>
100 + <th colSpan='2'>에픽 아이템</th>
101 + <th>나온 횟수</th>
102 + </tr>
103 + </thead>
104 + <tbody>
105 + {this.state.myEpicData.map(renderEpicData)}
106 + </tbody>
107 + </ReactBootStrap.Table>
108 + </div>
109 + <div>
110 + <br></br>
111 + </div>
112 + </div>
113 + <div>
114 + <div style={{width: "500px",marginLeft:"20px",display: "inline-block",float : "left"}}>
115 + <h3>오늘 에픽이 가장 많이 나온 채널</h3>
116 + <ReactBootStrap.Table striped bordered hover>
117 + <thead>
118 + <tr>
119 + <th>순위</th>
120 + <th>채널</th>
121 + <th>나온 횟수</th>
122 + </tr>
123 + </thead>
124 + <tbody>
125 + {this.state.myChannelData.map(renderChannelData)}
126 + </tbody>
127 + </ReactBootStrap.Table>
128 + </div>
129 + </div>
130 + </div>
131 + </div>
132 + )
133 + );
134 + }
135 +}
136 +
137 +export default Home;
138 +
1 +body {
2 + margin: 0;
3 + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 + sans-serif;
6 + -webkit-font-smoothing: antialiased;
7 + -moz-osx-font-smoothing: grayscale;
8 +}
9 +
10 +code {
11 + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 + monospace;
13 +}
1 +import React from 'react';
2 +import ReactDOM from 'react-dom';
3 +import './index.css';
4 +import App from './App';
5 +import * as serviceWorker from './serviceWorker';
6 +
7 +ReactDOM.render(
8 + <React.StrictMode>
9 + <App/>
10 + </React.StrictMode>,
11 + document.getElementById('root')
12 +);
13 +
14 +
15 +// If you want your app to work offline and load faster, you can change
16 +// unregister() to register() below. Note this comes with some pitfalls.
17 +// Learn more about service workers: https://bit.ly/CRA-PWA
18 +serviceWorker.unregister();
1 +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
2 + <g fill="#61DAFB">
3 + <path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
4 + <circle cx="420.9" cy="296.5" r="45.7"/>
5 + <path d="M520.5 78.1z"/>
6 + </g>
7 +</svg>
1 +// This optional code is used to register a service worker.
2 +// register() is not called by default.
3 +
4 +// This lets the app load faster on subsequent visits in production, and gives
5 +// it offline capabilities. However, it also means that developers (and users)
6 +// will only see deployed updates on subsequent visits to a page, after all the
7 +// existing tabs open on the page have been closed, since previously cached
8 +// resources are updated in the background.
9 +
10 +// To learn more about the benefits of this model and instructions on how to
11 +// opt-in, read https://bit.ly/CRA-PWA
12 +
13 +const isLocalhost = Boolean(
14 + window.location.hostname === 'localhost' ||
15 + // [::1] is the IPv6 localhost address.
16 + window.location.hostname === '[::1]' ||
17 + // 127.0.0.0/8 are considered localhost for IPv4.
18 + window.location.hostname.match(
19 + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
20 + )
21 +);
22 +
23 +export function register(config) {
24 + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
25 + // The URL constructor is available in all browsers that support SW.
26 + const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
27 + if (publicUrl.origin !== window.location.origin) {
28 + // Our service worker won't work if PUBLIC_URL is on a different origin
29 + // from what our page is served on. This might happen if a CDN is used to
30 + // serve assets; see https://github.com/facebook/create-react-app/issues/2374
31 + return;
32 + }
33 +
34 + window.addEventListener('load', () => {
35 + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
36 +
37 + if (isLocalhost) {
38 + // This is running on localhost. Let's check if a service worker still exists or not.
39 + checkValidServiceWorker(swUrl, config);
40 +
41 + // Add some additional logging to localhost, pointing developers to the
42 + // service worker/PWA documentation.
43 + navigator.serviceWorker.ready.then(() => {
44 + console.log(
45 + 'This web app is being served cache-first by a service ' +
46 + 'worker. To learn more, visit https://bit.ly/CRA-PWA'
47 + );
48 + });
49 + } else {
50 + // Is not localhost. Just register service worker
51 + registerValidSW(swUrl, config);
52 + }
53 + });
54 + }
55 +}
56 +
57 +function registerValidSW(swUrl, config) {
58 + navigator.serviceWorker
59 + .register(swUrl)
60 + .then(registration => {
61 + registration.onupdatefound = () => {
62 + const installingWorker = registration.installing;
63 + if (installingWorker == null) {
64 + return;
65 + }
66 + installingWorker.onstatechange = () => {
67 + if (installingWorker.state === 'installed') {
68 + if (navigator.serviceWorker.controller) {
69 + // At this point, the updated precached content has been fetched,
70 + // but the previous service worker will still serve the older
71 + // content until all client tabs are closed.
72 + console.log(
73 + 'New content is available and will be used when all ' +
74 + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
75 + );
76 +
77 + // Execute callback
78 + if (config && config.onUpdate) {
79 + config.onUpdate(registration);
80 + }
81 + } else {
82 + // At this point, everything has been precached.
83 + // It's the perfect time to display a
84 + // "Content is cached for offline use." message.
85 + console.log('Content is cached for offline use.');
86 +
87 + // Execute callback
88 + if (config && config.onSuccess) {
89 + config.onSuccess(registration);
90 + }
91 + }
92 + }
93 + };
94 + };
95 + })
96 + .catch(error => {
97 + console.error('Error during service worker registration:', error);
98 + });
99 +}
100 +
101 +function checkValidServiceWorker(swUrl, config) {
102 + // Check if the service worker can be found. If it can't reload the page.
103 + fetch(swUrl, {
104 + headers: { 'Service-Worker': 'script' },
105 + })
106 + .then(response => {
107 + // Ensure service worker exists, and that we really are getting a JS file.
108 + const contentType = response.headers.get('content-type');
109 + if (
110 + response.status === 404 ||
111 + (contentType != null && contentType.indexOf('javascript') === -1)
112 + ) {
113 + // No service worker found. Probably a different app. Reload the page.
114 + navigator.serviceWorker.ready.then(registration => {
115 + registration.unregister().then(() => {
116 + window.location.reload();
117 + });
118 + });
119 + } else {
120 + // Service worker found. Proceed as normal.
121 + registerValidSW(swUrl, config);
122 + }
123 + })
124 + .catch(() => {
125 + console.log(
126 + 'No internet connection found. App is running in offline mode.'
127 + );
128 + });
129 +}
130 +
131 +export function unregister() {
132 + if ('serviceWorker' in navigator) {
133 + navigator.serviceWorker.ready
134 + .then(registration => {
135 + registration.unregister();
136 + })
137 + .catch(error => {
138 + console.error(error.message);
139 + });
140 + }
141 +}
1 +// jest-dom adds custom jest matchers for asserting on DOM nodes.
2 +// allows you to do things like:
3 +// expect(element).toHaveTextContent(/react/i)
4 +// learn more: https://github.com/testing-library/jest-dom
5 +import '@testing-library/jest-dom/extend-expect';
1 +import React, { Component } from 'react';
2 +import {BootstrapTable,
3 + TableHeaderColumn} from 'react-bootstrap-table';
4 +import 'bootstrap/dist/css/bootstrap.min.css';
5 +// import '../css/Table.css';
6 +// import '../../node_modules/react-bootstrap-table/css/react-bootstrap-table.css'
7 +
8 +
9 +class Table extends Component {
10 + render(){
11 + return (
12 + <div className="Table">
13 + <tr>
14 + <td>{}
15 + </td>
16 + </tr>
17 + </div>
18 + );
19 + }
20 +}
21 +
22 +export default Table;
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.