swa07016

프록시 재설정, api/datas, MealCard 생성

1 node_modules 1 node_modules
2 +json_datas.json
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -1794,6 +1794,51 @@ ...@@ -1794,6 +1794,51 @@
1794 "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", 1794 "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz",
1795 "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" 1795 "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg=="
1796 }, 1796 },
1797 + "@fortawesome/fontawesome-common-types": {
1798 + "version": "0.2.28",
1799 + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.28.tgz",
1800 + "integrity": "sha512-gtis2/5yLdfI6n0ia0jH7NJs5i/Z/8M/ZbQL6jXQhCthEOe5Cr5NcQPhgTvFxNOtURE03/ZqUcEskdn2M+QaBg=="
1801 + },
1802 + "@fortawesome/fontawesome-svg-core": {
1803 + "version": "1.2.28",
1804 + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.28.tgz",
1805 + "integrity": "sha512-4LeaNHWvrneoU0i8b5RTOJHKx7E+y7jYejplR7uSVB34+mp3Veg7cbKk7NBCLiI4TyoWS1wh9ZdoyLJR8wSAdg==",
1806 + "requires": {
1807 + "@fortawesome/fontawesome-common-types": "^0.2.28"
1808 + }
1809 + },
1810 + "@fortawesome/free-brands-svg-icons": {
1811 + "version": "5.13.0",
1812 + "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.13.0.tgz",
1813 + "integrity": "sha512-/6xXiJFCMEQxqxXbL0FPJpwq5Cv6MRrjsbJEmH/t5vOvB4dILDpnY0f7zZSlA8+TG7jwlt12miF/yZpZkykucA==",
1814 + "requires": {
1815 + "@fortawesome/fontawesome-common-types": "^0.2.28"
1816 + }
1817 + },
1818 + "@fortawesome/free-regular-svg-icons": {
1819 + "version": "5.13.0",
1820 + "resolved": "https://registry.npmjs.org/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-5.13.0.tgz",
1821 + "integrity": "sha512-70FAyiS5j+ANYD4dh9NGowTorNDnyvQHHpCM7FpnF7GxtDjBUCKdrFqCPzesEIpNDFNd+La3vex+jDk4nnUfpA==",
1822 + "requires": {
1823 + "@fortawesome/fontawesome-common-types": "^0.2.28"
1824 + }
1825 + },
1826 + "@fortawesome/free-solid-svg-icons": {
1827 + "version": "5.13.0",
1828 + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.13.0.tgz",
1829 + "integrity": "sha512-IHUgDJdomv6YtG4p3zl1B5wWf9ffinHIvebqQOmV3U+3SLw4fC+LUCCgwfETkbTtjy5/Qws2VoVf6z/ETQpFpg==",
1830 + "requires": {
1831 + "@fortawesome/fontawesome-common-types": "^0.2.28"
1832 + }
1833 + },
1834 + "@fortawesome/react-fontawesome": {
1835 + "version": "0.1.9",
1836 + "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.9.tgz",
1837 + "integrity": "sha512-49V3WNysLZU5fZ3sqSuys4nGRytsrxJktbv3vuaXkEoxv22C6T7TEG0TW6+nqVjMnkfCQd5xOnmJoZHMF78tOw==",
1838 + "requires": {
1839 + "prop-types": "^15.7.2"
1840 + }
1841 + },
1797 "@hapi/address": { 1842 "@hapi/address": {
1798 "version": "2.1.4", 1843 "version": "2.1.4",
1799 "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", 1844 "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
...@@ -2313,6 +2358,14 @@ ...@@ -2313,6 +2358,14 @@
2313 "@types/node": "*" 2358 "@types/node": "*"
2314 } 2359 }
2315 }, 2360 },
2361 + "@types/http-proxy": {
2362 + "version": "1.17.4",
2363 + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.4.tgz",
2364 + "integrity": "sha512-IrSHl2u6AWXduUaDLqYpt45tLVCtYv7o4Z0s1KghBCDgIIS9oW5K1H8mZG/A2CfeLdEa7rTd1ACOiHBc1EMT2Q==",
2365 + "requires": {
2366 + "@types/node": "*"
2367 + }
2368 + },
2316 "@types/istanbul-lib-coverage": { 2369 "@types/istanbul-lib-coverage": {
2317 "version": "2.0.1", 2370 "version": "2.0.1",
2318 "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", 2371 "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz",
...@@ -3104,6 +3157,37 @@ ...@@ -3104,6 +3157,37 @@
3104 "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", 3157 "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz",
3105 "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" 3158 "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug=="
3106 }, 3159 },
3160 + "axios": {
3161 + "version": "0.19.2",
3162 + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
3163 + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
3164 + "requires": {
3165 + "follow-redirects": "1.5.10"
3166 + },
3167 + "dependencies": {
3168 + "debug": {
3169 + "version": "3.1.0",
3170 + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
3171 + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
3172 + "requires": {
3173 + "ms": "2.0.0"
3174 + }
3175 + },
3176 + "follow-redirects": {
3177 + "version": "1.5.10",
3178 + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
3179 + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
3180 + "requires": {
3181 + "debug": "=3.1.0"
3182 + }
3183 + },
3184 + "ms": {
3185 + "version": "2.0.0",
3186 + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
3187 + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
3188 + }
3189 + }
3190 + },
3107 "axobject-query": { 3191 "axobject-query": {
3108 "version": "2.1.2", 3192 "version": "2.1.2",
3109 "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.1.2.tgz", 3193 "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.1.2.tgz",
...@@ -6975,9 +7059,9 @@ ...@@ -6975,9 +7059,9 @@
6975 "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=" 7059 "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q="
6976 }, 7060 },
6977 "http-proxy": { 7061 "http-proxy": {
6978 - "version": "1.18.0", 7062 + "version": "1.18.1",
6979 - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.0.tgz", 7063 + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
6980 - "integrity": "sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ==", 7064 + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
6981 "requires": { 7065 "requires": {
6982 "eventemitter3": "^4.0.0", 7066 "eventemitter3": "^4.0.0",
6983 "follow-redirects": "^1.0.0", 7067 "follow-redirects": "^1.0.0",
...@@ -6985,14 +7069,55 @@ ...@@ -6985,14 +7069,55 @@
6985 } 7069 }
6986 }, 7070 },
6987 "http-proxy-middleware": { 7071 "http-proxy-middleware": {
6988 - "version": "0.19.1", 7072 + "version": "1.0.4",
6989 - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz", 7073 + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-1.0.4.tgz",
6990 - "integrity": "sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q==", 7074 + "integrity": "sha512-8wiqujNWlsZNbeTSSWMLUl/u70xbJ5VYRwPR8RcAbvsNxzAZbgwLzRvT96btbm3fAitZUmo5i8LY6WKGyHDgvA==",
6991 "requires": { 7075 "requires": {
6992 - "http-proxy": "^1.17.0", 7076 + "@types/http-proxy": "^1.17.4",
6993 - "is-glob": "^4.0.0", 7077 + "http-proxy": "^1.18.1",
6994 - "lodash": "^4.17.11", 7078 + "is-glob": "^4.0.1",
6995 - "micromatch": "^3.1.10" 7079 + "lodash": "^4.17.15",
7080 + "micromatch": "^4.0.2"
7081 + },
7082 + "dependencies": {
7083 + "braces": {
7084 + "version": "3.0.2",
7085 + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
7086 + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
7087 + "requires": {
7088 + "fill-range": "^7.0.1"
7089 + }
7090 + },
7091 + "fill-range": {
7092 + "version": "7.0.1",
7093 + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
7094 + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
7095 + "requires": {
7096 + "to-regex-range": "^5.0.1"
7097 + }
7098 + },
7099 + "is-number": {
7100 + "version": "7.0.0",
7101 + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
7102 + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
7103 + },
7104 + "micromatch": {
7105 + "version": "4.0.2",
7106 + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
7107 + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
7108 + "requires": {
7109 + "braces": "^3.0.1",
7110 + "picomatch": "^2.0.5"
7111 + }
7112 + },
7113 + "to-regex-range": {
7114 + "version": "5.0.1",
7115 + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
7116 + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
7117 + "requires": {
7118 + "is-number": "^7.0.0"
7119 + }
7120 + }
6996 } 7121 }
6997 }, 7122 },
6998 "http-signature": { 7123 "http-signature": {
...@@ -13931,6 +14056,17 @@ ...@@ -13931,6 +14056,17 @@
13931 } 14056 }
13932 } 14057 }
13933 }, 14058 },
14059 + "http-proxy-middleware": {
14060 + "version": "0.19.1",
14061 + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz",
14062 + "integrity": "sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q==",
14063 + "requires": {
14064 + "http-proxy": "^1.17.0",
14065 + "is-glob": "^4.0.0",
14066 + "lodash": "^4.17.11",
14067 + "micromatch": "^3.1.10"
14068 + }
14069 + },
13934 "is-absolute-url": { 14070 "is-absolute-url": {
13935 "version": "3.0.3", 14071 "version": "3.0.3",
13936 "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-3.0.3.tgz", 14072 "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-3.0.3.tgz",
......
...@@ -3,10 +3,17 @@ ...@@ -3,10 +3,17 @@
3 "version": "0.1.0", 3 "version": "0.1.0",
4 "private": true, 4 "private": true,
5 "dependencies": { 5 "dependencies": {
6 + "@fortawesome/fontawesome-svg-core": "^1.2.28",
7 + "@fortawesome/free-brands-svg-icons": "^5.13.0",
8 + "@fortawesome/free-regular-svg-icons": "^5.13.0",
9 + "@fortawesome/free-solid-svg-icons": "^5.13.0",
10 + "@fortawesome/react-fontawesome": "^0.1.9",
6 "@testing-library/jest-dom": "^4.2.4", 11 "@testing-library/jest-dom": "^4.2.4",
7 "@testing-library/react": "^9.3.2", 12 "@testing-library/react": "^9.3.2",
8 "@testing-library/user-event": "^7.1.2", 13 "@testing-library/user-event": "^7.1.2",
14 + "axios": "^0.19.2",
9 "bootstrap": "^4.5.0", 15 "bootstrap": "^4.5.0",
16 + "http-proxy-middleware": "^1.0.4",
10 "react": "^16.13.1", 17 "react": "^16.13.1",
11 "react-app-polyfill": "^1.0.6", 18 "react-app-polyfill": "^1.0.6",
12 "react-dom": "^16.13.1", 19 "react-dom": "^16.13.1",
...@@ -34,6 +41,5 @@ ...@@ -34,6 +41,5 @@
34 "last 1 firefox version", 41 "last 1 firefox version",
35 "last 1 safari version" 42 "last 1 safari version"
36 ] 43 ]
37 - }, 44 + }
38 - "proxy": "http://localhost:5000/"
39 } 45 }
......
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html lang="en" style="margin: 0; 2 <html lang="en" style="margin: 0;
3 height: 100%; 3 height: 100%;
4 -overflow: hidden; 4 +
5 "> 5 ">
6 <head> 6 <head>
7 <meta charset="utf-8" /> 7 <meta charset="utf-8" />
...@@ -29,7 +29,7 @@ overflow: hidden; ...@@ -29,7 +29,7 @@ overflow: hidden;
29 --> 29 -->
30 <title>MEALKHU</title> 30 <title>MEALKHU</title>
31 </head> 31 </head>
32 - <body style="width : 100%; height:100%; margin: 0; overflow:hidden;"> 32 + <body style="width : 100%; height:100%; margin: 0;">
33 <noscript>You need to enable JavaScript to run this app.</noscript> 33 <noscript>You need to enable JavaScript to run this app.</noscript>
34 <div id="root" style="width : 100%; height:100%;"></div> 34 <div id="root" style="width : 100%; height:100%;"></div>
35 <!-- 35 <!--
......
1 { 1 {
2 - "short_name": "React App", 2 + "short_name": "MEALKHU",
3 - "name": "Create React App Sample", 3 + "name": "MEALKHU",
4 "icons": [ 4 "icons": [
5 { 5 {
6 - "src": "favicon.ico", 6 + "src": "fork.ico",
7 "sizes": "64x64 32x32 24x24 16x16", 7 "sizes": "64x64 32x32 24x24 16x16",
8 "type": "image/x-icon" 8 "type": "image/x-icon"
9 }, 9 },
10 { 10 {
11 - "src": "logo192.png", 11 + "src": "fork.ico",
12 "type": "image/png", 12 "type": "image/png",
13 "sizes": "192x192" 13 "sizes": "192x192"
14 }, 14 },
15 { 15 {
16 - "src": "logo512.png", 16 + "src": "fork.ico",
17 "type": "image/png", 17 "type": "image/png",
18 "sizes": "512x512" 18 "sizes": "512x512"
19 } 19 }
......
1 +button {
2 + opacity: 1.0;
3 + }
4 +
5 + button:hover {
6 + opacity: 0.2;
7 + }
1 +import React from 'react';
2 +import { Card, CardBody, CardTitle, CardText, CardImg, CardFooter, Button } from 'reactstrap';
3 +import './MealCard.css';
4 +import { faAngleRight } from "@fortawesome/free-solid-svg-icons"
5 +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
6 +
7 +const MealCard = (props) => {
8 + return (
9 + <>
10 + <Card style={{
11 + 'marginTop': '0.6rem',
12 + 'marginBottom': '0.6rem',
13 + 'boxShadow': '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'
14 + }}>
15 +
16 + <CardImg
17 + top width="100%"
18 + onerror="this.src='https://pngimage.net/wp-content/uploads/2018/06/no-image-available-icon-png-8.png'"
19 + src={props.img} alt="Card image cap" />
20 + <CardBody>
21 + <CardTitle><strong>{props.name}</strong></CardTitle>
22 + <CardText>
23 + <small>{props.menu}</small>
24 + </CardText>
25 + </CardBody>
26 + <CardFooter className="wrap" style={{
27 + 'padding': '0 0 0 0'
28 + }}>
29 +
30 + <Button
31 + className="button"
32 + style={{
33 + 'width':'100%',
34 + 'borderRadius':'0 0 0 0',
35 + 'backgroundColor': '#F6F6F6',
36 + 'border': '0px',
37 + 'color':'black'
38 + }}>
39 + <span style={{
40 + 'float':'left',
41 + 'fontSize': '14px'
42 + }}>
43 + View more
44 + </span>
45 + <FontAwesomeIcon style={{
46 + 'color': 'black',
47 + 'float': 'right',
48 + 'paddingTop':'0.1rem'
49 + }}
50 + size="lg" icon={faAngleRight} />
51 + </Button>
52 + </CardFooter>
53 + </Card>
54 + </>
55 + );
56 +};
57 +
58 +export default MealCard;
...\ No newline at end of file ...\ No newline at end of file
...@@ -18,11 +18,11 @@ const NavBar = (props) => { ...@@ -18,11 +18,11 @@ const NavBar = (props) => {
18 return ( 18 return (
19 <div> 19 <div>
20 20
21 - <Navbar style={{'background-color': '#940f0f'}} light expand="md"> 21 + <Navbar style={{'backgroundColor': '#940f0f'}} light expand="md">
22 <Container className="themed-container"> 22 <Container className="themed-container">
23 - <png> 23 + <span>
24 <a href='/'><img src="logo.png" width="50" /></a> 24 <a href='/'><img src="logo.png" width="50" /></a>
25 - </png> 25 + </span>
26 <NavbarBrand href="/" style={{'marginLeft':'1.5rem', 'color':'#fff'}}>MEALKHU</NavbarBrand> 26 <NavbarBrand href="/" style={{'marginLeft':'1.5rem', 'color':'#fff'}}>MEALKHU</NavbarBrand>
27 <NavbarToggler onClick={toggle} /> 27 <NavbarToggler onClick={toggle} />
28 <Collapse isOpen={isOpen} navbar> 28 <Collapse isOpen={isOpen} navbar>
......
...@@ -2,6 +2,7 @@ import React from 'react'; ...@@ -2,6 +2,7 @@ import React from 'react';
2 import NavBar from '../components/NavBar'; 2 import NavBar from '../components/NavBar';
3 3
4 const LandingPage = (props) => { 4 const LandingPage = (props) => {
5 +
5 return ( 6 return (
6 <> 7 <>
7 <NavBar/> 8 <NavBar/>
......
1 -import React from 'react'; 1 +import React, { useState, useEffect } from 'react';
2 import NavBar from '../components/NavBar'; 2 import NavBar from '../components/NavBar';
3 +import MealCard from '../components/MealCard';
4 +import { Container, Row, Col } from "reactstrap";
5 +import axios from 'axios';
3 6
4 const MenuPage = (props) => { 7 const MenuPage = (props) => {
8 + const [datas, setDatas] = useState([]);
9 + const [isLoading, setIsLoading] = useState(false);
10 + useEffect(() => {
11 + const fetchData = async () => {
12 + const result = await axios(
13 + 'http://192.168.0.2:5000/api/datas',
14 + // localhost로 바꾸기
15 + );
16 + setDatas(result.data);
17 + setIsLoading(true);
18 + };
19 +
20 + fetchData();
21 + }, []);
22 +
5 return ( 23 return (
6 <> 24 <>
7 <NavBar/> 25 <NavBar/>
8 - menu page 26 + <Container>
27 + <Row xs="2" sm="2" md="4">
28 +
29 + {
30 + isLoading ? (
31 + datas.map((data) =>
32 + <Col>
33 + <MealCard
34 + id = {data.id}
35 + name = {data.name}
36 + address = {data.address}
37 + latitude = {data.latitude}
38 + longitude = {data.longitude}
39 + type = {data.type}
40 + menu = {data.menu}
41 + img = {data.img}
42 + img_source = {data.img_source}
43 + />
44 + </Col>
45 + )
46 + ) : 'Loading'
47 + }
48 +
49 +
50 + </Row>
51 + </Container>
9 </> 52 </>
10 ); 53 );
11 } 54 }
......
1 +const { createProxyMiddleware } = require('http-proxy-middleware');
2 +
3 +module.exports = function(app) {
4 + app.use(
5 + '/api',
6 + createProxyMiddleware({
7 + target: 'http://localhost:5000',
8 + changeOrigin: true,
9 + })
10 + );
11 +};
...\ No newline at end of file ...\ No newline at end of file
...@@ -46,6 +46,16 @@ ...@@ -46,6 +46,16 @@
46 "qs": "6.7.0", 46 "qs": "6.7.0",
47 "raw-body": "2.4.0", 47 "raw-body": "2.4.0",
48 "type-is": "~1.6.17" 48 "type-is": "~1.6.17"
49 + },
50 + "dependencies": {
51 + "iconv-lite": {
52 + "version": "0.4.24",
53 + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
54 + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
55 + "requires": {
56 + "safer-buffer": ">= 2.1.2 < 3"
57 + }
58 + }
49 } 59 }
50 }, 60 },
51 "bytes": { 61 "bytes": {
...@@ -303,9 +313,9 @@ ...@@ -303,9 +313,9 @@
303 } 313 }
304 }, 314 },
305 "iconv-lite": { 315 "iconv-lite": {
306 - "version": "0.4.24", 316 + "version": "0.5.1",
307 - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 317 + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.1.tgz",
308 - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 318 + "integrity": "sha512-ONHr16SQvKZNSqjQT9gy5z24Jw+uqfO02/ngBSBoqChZ+W8qXX7GPRa1RoUnzGADw8K63R1BXUMzarCVQBpY8Q==",
309 "requires": { 319 "requires": {
310 "safer-buffer": ">= 2.1.2 < 3" 320 "safer-buffer": ">= 2.1.2 < 3"
311 } 321 }
...@@ -494,6 +504,16 @@ ...@@ -494,6 +504,16 @@
494 "http-errors": "1.7.2", 504 "http-errors": "1.7.2",
495 "iconv-lite": "0.4.24", 505 "iconv-lite": "0.4.24",
496 "unpipe": "1.0.0" 506 "unpipe": "1.0.0"
507 + },
508 + "dependencies": {
509 + "iconv-lite": {
510 + "version": "0.4.24",
511 + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
512 + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
513 + "requires": {
514 + "safer-buffer": ">= 2.1.2 < 3"
515 + }
516 + }
497 } 517 }
498 }, 518 },
499 "read-pkg": { 519 "read-pkg": {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
17 "dependencies": { 17 "dependencies": {
18 "body-parser": "^1.19.0", 18 "body-parser": "^1.19.0",
19 "concurrently": "^5.2.0", 19 "concurrently": "^5.2.0",
20 - "express": "^4.17.1" 20 + "express": "^4.17.1",
21 + "iconv-lite": "^0.5.1"
21 } 22 }
22 } 23 }
......
1 const express = require('express'); 1 const express = require('express');
2 const bodyParser = require('body-parser'); 2 const bodyParser = require('body-parser');
3 +const fs = require('fs');
4 +var iconv = require('iconv-lite');
3 5
4 const app = express(); 6 const app = express();
5 const port = process.env.PORT || 5000; 7 const port = process.env.PORT || 5000;
6 8
9 +const dataBuffer = fs.readFileSync('json_datas.json')
10 +
7 app.use(bodyParser.json()); 11 app.use(bodyParser.json());
8 app.use(bodyParser.urlencoded({ extended: true })); 12 app.use(bodyParser.urlencoded({ extended: true }));
9 13
...@@ -12,4 +16,11 @@ app.get('/api/hello', (req, res) => { ...@@ -12,4 +16,11 @@ app.get('/api/hello', (req, res) => {
12 res.send('Hello skrrrr!'); 16 res.send('Hello skrrrr!');
13 }); 17 });
14 18
19 +
20 +app.get('/api/datas', (req, res) => {
21 + iconv.extendNodeEncodings();
22 + res.header("Access-Control-Allow-Origin", "http://localhost:3000");
23 + res.send(iconv.decode(dataBuffer, 'EUC-KR').toString());
24 +})
25 +
15 app.listen(port, () => console.log(`Listening on port ${port}`)); 26 app.listen(port, () => console.log(`Listening on port ${port}`));
...\ No newline at end of file ...\ No newline at end of file
......