
--- Global.js
+++ Global.js
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 |
const SERVICE_STATUS = process.env.NODE_ENV;//development, production |
6 | 6 |
const PORT = 80; |
7 | 7 |
const SYSTEM_VIEW_TYPE = 'admin';//admin, government, agency, guardian |
8 |
+const API_SERVER_HOST = 'localhost:8080' |
|
8 | 9 |
|
9 | 10 |
module.exports = { |
10 | 11 |
PROJECT_NAME, |
... | ... | @@ -12,5 +13,6 @@ |
12 | 13 |
BASE_DIR, |
13 | 14 |
LOG_BASE_DIR, |
14 | 15 |
SERVICE_STATUS, |
15 |
- PORT |
|
16 |
+ PORT, |
|
17 |
+ API_SERVER_HOST, |
|
16 | 18 |
}(No newline at end of file) |
--- client/views/pages/user_management/UserAuthoriySelect_agency.jsx
+++ client/views/pages/user_management/UserAuthoriySelect_agency.jsx
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 |
import { useNavigate } from "react-router"; |
7 | 7 |
|
8 | 8 |
export default function UserAuthoriySelect_agency() { |
9 |
- |
|
9 |
+ const [subjectList, setSubjectList] = React.useState([]); |
|
10 | 10 |
//초기값 세팅 |
11 | 11 |
const [regiNumber, setRegiNumber] = React.useState(""); |
12 | 12 |
const [userName, setUserName] = React.useState(""); |
... | ... | @@ -76,6 +76,19 @@ |
76 | 76 |
// }).catch((error) => { |
77 | 77 |
// console.log('selectNotice() /Notice/selectNotice.json error : ', error); |
78 | 78 |
// }); |
79 |
+ }; |
|
80 |
+ const getSubjectSelect = () => { |
|
81 |
+ fetch("/user/subjectList.json", { |
|
82 |
+ method: "POST", |
|
83 |
+ headers: { |
|
84 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
85 |
+ }, |
|
86 |
+ }).then((response) => response.json()).then((data) => { |
|
87 |
+ console.log(data); |
|
88 |
+ // setSubjectList(data.rows); |
|
89 |
+ }).catch((error) => { |
|
90 |
+ console.log('getSubjectSelect() /user/subjectList.json error : ', error); |
|
91 |
+ }); |
|
79 | 92 |
}; |
80 | 93 |
const navigate = useNavigate(); |
81 | 94 |
const [modalOpen, setModalOpen] = React.useState(false); |
... | ... | @@ -292,7 +305,7 @@ |
292 | 305 |
<Table |
293 | 306 |
className={"protector-user"} |
294 | 307 |
head={thead1} |
295 |
- contents={content1} |
|
308 |
+ contents={subjectList} |
|
296 | 309 |
contentKey={key1} |
297 | 310 |
/> |
298 | 311 |
), |
... | ... | @@ -312,6 +325,11 @@ |
312 | 325 |
]; |
313 | 326 |
|
314 | 327 |
const [index, setIndex] = React.useState(1); |
328 |
+ |
|
329 |
+ React.useEffect(() => { |
|
330 |
+ getSubjectSelect(); |
|
331 |
+ |
|
332 |
+ }, []) |
|
315 | 333 |
return ( |
316 | 334 |
<main> |
317 | 335 |
<Modal open={modalOpen} close={closeModal} header="'김복남'님의 가족"> |
--- server/modules/web/Server.js
+++ server/modules/web/Server.js
... | ... | @@ -3,12 +3,12 @@ |
3 | 3 |
* @since : 2022.09.20 |
4 | 4 |
* @dscription : Express 라이브러리 활용 HTTP Web Server 모듈입니다. |
5 | 5 |
*/ |
6 |
-const { BASE_DIR, PORT } = require('../../../Global'); |
|
6 |
+const { BASE_DIR, PORT, API_SERVER_HOST } = require('../../../Global'); |
|
7 | 7 |
const JsxToJsBuild = require('./build/JsxToJsBuild');//JSX파일을 JS파일로 Build 해주는 모듈 |
8 | 8 |
const Logger = require('../log/Logger');//Logger(필수) |
9 |
- |
|
10 | 9 |
const express = require('express'); |
11 | 10 |
const webServer = express(); |
11 |
+var expressProxy = require('express-http-proxy'); |
|
12 | 12 |
|
13 | 13 |
/** |
14 | 14 |
* @author : 최정우 |
... | ... | @@ -97,6 +97,17 @@ |
97 | 97 |
response.sendFile(`${BASE_DIR}/client/views/index.html`); |
98 | 98 |
}) |
99 | 99 |
/** |
100 |
++ * @author : 방선주 |
|
101 |
++ * @since : 2023.02.14 |
|
102 |
++ * @dscription : REST API 서버에 데이터 요청 보내기(Proxy) |
|
103 |
++ */ |
|
104 |
++webServer.use('*.json', expressProxy(API_SERVER_HOST, { |
|
105 |
+ proxyReqPathResolver: function (request) { |
|
106 |
+ //console.log('request : ', request.url, request.params[0]); |
|
107 |
+ return `${request.params['0']}.json`; |
|
108 |
+ } |
|
109 |
+ })); |
|
110 |
+/** |
|
100 | 111 |
* @author : 최정우 |
101 | 112 |
* @since : 2022.09.21 |
102 | 113 |
* @dscription : Global Error Handler (*맨 마지막에 적용해야됨) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?