diff --git a/main.js b/main.js
index 37a2200..0be95ca 100644
--- a/main.js
+++ b/main.js
@@ -6,6 +6,7 @@ const bodyParser = require("body-parser");
const path = require('path');
const db = require('./src/config/db.js');
const app = express();
+const rabbitmq = require("./src/rabbit/rabbitMQ.js")
//에러 라우팅
const errorController = require("./src/controllers/errorControllers.js");
@@ -40,16 +41,10 @@ app.use(errorController.logErrors);
app.use(errorController.respondNoResourceFound);
app.use(errorController.respondInternalEroor);
-//래빗mq
-//const mq = require("./src/rabbit/rabbitmq-api.js");
-//app.post("/send_msg", mq.send_message);
-//app.get("/get_msg", mq.recv_message);
-
-// const port = process.env.PORT;
-const port = 3001;
+const port = process.env.PORT;
app.listen(port, ()=> {
console.log('running')
})
-
+//develop2 branch 연결 테스트
module.exports = app;
diff --git a/package-lock.json b/package-lock.json
index dfab410..77099c6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
+ "@google-cloud/storage": "^7.16.0",
"amqplib": "^0.10.8",
"bcrypt": "^5.1.1",
"cors": "^2.8.5",
@@ -21,6 +22,75 @@
"mysql2": "^3.14.1"
}
},
+ "node_modules/@google-cloud/paginator": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-5.0.2.tgz",
+ "integrity": "sha512-DJS3s0OVH4zFDB1PzjxAsHqJT6sKVbRwwML0ZBP9PbU7Yebtu/7SWMRzvO2J3nUi9pRNITCfu4LJeooM2w4pjg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "arrify": "^2.0.0",
+ "extend": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/@google-cloud/projectify": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-4.0.0.tgz",
+ "integrity": "sha512-MmaX6HeSvyPbWGwFq7mXdo0uQZLGBYCwziiLIGq5JVX+/bdI3SAq6bP98trV5eTWfLuvsMcIC1YJOF2vfteLFA==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/@google-cloud/promisify": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-4.0.0.tgz",
+ "integrity": "sha512-Orxzlfb9c67A15cq2JQEyVc7wEsmFBmHjZWZYQMUyJ1qivXyMwdyNOs9odi79hze+2zqdTtu1E19IM/FtqZ10g==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/@google-cloud/storage": {
+ "version": "7.16.0",
+ "resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-7.16.0.tgz",
+ "integrity": "sha512-7/5LRgykyOfQENcm6hDKP8SX/u9XxE5YOiWOkgkwcoO+cG8xT/cyOvp9wwN3IxfdYgpHs8CE7Nq2PKX2lNaEXw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@google-cloud/paginator": "^5.0.0",
+ "@google-cloud/projectify": "^4.0.0",
+ "@google-cloud/promisify": "<4.1.0",
+ "abort-controller": "^3.0.0",
+ "async-retry": "^1.3.3",
+ "duplexify": "^4.1.3",
+ "fast-xml-parser": "^4.4.1",
+ "gaxios": "^6.0.2",
+ "google-auth-library": "^9.6.3",
+ "html-entities": "^2.5.2",
+ "mime": "^3.0.0",
+ "p-limit": "^3.0.1",
+ "retry-request": "^7.0.0",
+ "teeny-request": "^9.0.0",
+ "uuid": "^8.0.0"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/@google-cloud/storage/node_modules/mime": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
+ "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
+ "license": "MIT",
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
"node_modules/@mapbox/node-pre-gyp": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz",
@@ -40,11 +110,65 @@
"node-pre-gyp": "bin/node-pre-gyp"
}
},
+ "node_modules/@tootallnate/once": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
+ "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@types/caseless": {
+ "version": "0.12.5",
+ "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.5.tgz",
+ "integrity": "sha512-hWtVTC2q7hc7xZ/RLbxapMvDMgUnDvKvMOpKal4DrMyfGBUfB1oKaZlIRr6mJL+If3bAP6sV/QneGzF6tJjZDg==",
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "22.15.21",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.21.tgz",
+ "integrity": "sha512-EV/37Td6c+MgKAbkcLG6vqZ2zEYHD7bvSrzqqs2RIhbA6w3x+Dqz8MZM3sP6kGTeLrdoOgKZe+Xja7tUB2DNkQ==",
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~6.21.0"
+ }
+ },
+ "node_modules/@types/request": {
+ "version": "2.48.12",
+ "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.12.tgz",
+ "integrity": "sha512-G3sY+NpsA9jnwm0ixhAFQSJ3Q9JkpLZpJbI3GMv0mIAT0y3mRabYeINzal5WOChIiaTEGQYlHOKgkaM9EisWHw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/caseless": "*",
+ "@types/node": "*",
+ "@types/tough-cookie": "*",
+ "form-data": "^2.5.0"
+ }
+ },
+ "node_modules/@types/tough-cookie": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
+ "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==",
+ "license": "MIT"
+ },
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
},
+ "node_modules/abort-controller": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
+ "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
+ "license": "MIT",
+ "dependencies": {
+ "event-target-shim": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=6.5"
+ }
+ },
"node_modules/accepts": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
@@ -134,11 +258,35 @@
"node": ">= 6"
}
},
+ "node_modules/arrify": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
+ "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/async": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA=="
},
+ "node_modules/async-retry": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz",
+ "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==",
+ "license": "MIT",
+ "dependencies": {
+ "retry": "0.13.1"
+ }
+ },
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "license": "MIT"
+ },
"node_modules/aws-ssl-profiles": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz",
@@ -152,6 +300,26 @@
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
"node_modules/basic-auth": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
@@ -217,6 +385,12 @@
"concat-map": "0.0.1"
}
},
+ "node_modules/buffer-equal-constant-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
+ "license": "BSD-3-Clause"
+ },
"node_modules/buffer-more-ints": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-1.0.0.tgz",
@@ -305,6 +479,18 @@
"color-support": "bin.js"
}
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "license": "MIT",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -391,6 +577,15 @@
}
}
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@@ -444,6 +639,41 @@
"node": ">= 0.4"
}
},
+ "node_modules/duplexify": {
+ "version": "4.1.3",
+ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.3.tgz",
+ "integrity": "sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==",
+ "license": "MIT",
+ "dependencies": {
+ "end-of-stream": "^1.4.1",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1",
+ "stream-shift": "^1.0.2"
+ }
+ },
+ "node_modules/duplexify/node_modules/readable-stream": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+ "license": "MIT",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/ecdsa-sig-formatter": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@@ -476,6 +706,15 @@
"node": ">= 0.8"
}
},
+ "node_modules/end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "license": "MIT",
+ "dependencies": {
+ "once": "^1.4.0"
+ }
+ },
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
@@ -503,6 +742,21 @@
"node": ">= 0.4"
}
},
+ "node_modules/es-set-tostringtag": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
+ "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -516,6 +770,15 @@
"node": ">= 0.6"
}
},
+ "node_modules/event-target-shim": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
+ "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
@@ -562,6 +825,30 @@
"url": "https://opencollective.com/express"
}
},
+ "node_modules/extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "license": "MIT"
+ },
+ "node_modules/fast-xml-parser": {
+ "version": "4.5.3",
+ "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.3.tgz",
+ "integrity": "sha512-RKihhV+SHsIUGXObeVy9AXiBbFwkVk7Syp8XgwN5U3JV416+Gwp/GO9i0JYKmikykgz/UHRrrV4ROuZEo/T0ig==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/NaturalIntelligence"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "strnum": "^1.1.1"
+ },
+ "bin": {
+ "fxparser": "src/cli/cli.js"
+ }
+ },
"node_modules/filelist": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
@@ -624,6 +911,43 @@
}
}
},
+ "node_modules/form-data": {
+ "version": "2.5.3",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.3.tgz",
+ "integrity": "sha512-XHIrMD0NpDrNM/Ckf7XJiBbLl57KEhT3+i3yY+eWm+cqYZJQTZrKo8Y8AWKnuV5GT4scfuUGt9LzNoIx3dU1nQ==",
+ "license": "MIT",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "mime-types": "^2.1.35",
+ "safe-buffer": "^5.2.1"
+ },
+ "engines": {
+ "node": ">= 0.12"
+ }
+ },
+ "node_modules/form-data/node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/form-data/node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
@@ -695,6 +1019,71 @@
"node": ">=10"
}
},
+ "node_modules/gaxios": {
+ "version": "6.7.1",
+ "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz",
+ "integrity": "sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "extend": "^3.0.2",
+ "https-proxy-agent": "^7.0.1",
+ "is-stream": "^2.0.0",
+ "node-fetch": "^2.6.9",
+ "uuid": "^9.0.1"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/gaxios/node_modules/agent-base": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",
+ "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/gaxios/node_modules/https-proxy-agent": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/gaxios/node_modules/uuid": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
+ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/gcp-metadata": {
+ "version": "6.1.1",
+ "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.1.tgz",
+ "integrity": "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "gaxios": "^6.1.1",
+ "google-logging-utils": "^0.0.2",
+ "json-bigint": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/generate-function": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
@@ -758,6 +1147,32 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/google-auth-library": {
+ "version": "9.15.1",
+ "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz",
+ "integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "base64-js": "^1.3.0",
+ "ecdsa-sig-formatter": "^1.0.11",
+ "gaxios": "^6.1.1",
+ "gcp-metadata": "^6.1.0",
+ "gtoken": "^7.0.0",
+ "jws": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/google-logging-utils": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz",
+ "integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
@@ -769,6 +1184,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/gtoken": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz",
+ "integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==",
+ "license": "MIT",
+ "dependencies": {
+ "gaxios": "^6.0.0",
+ "jws": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -788,6 +1216,21 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/has-tostringtag": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
+ "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
+ "license": "MIT",
+ "dependencies": {
+ "has-symbols": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/has-unicode": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
@@ -823,6 +1266,22 @@
"node": ">=12"
}
},
+ "node_modules/html-entities": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.6.0.tgz",
+ "integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/mdevils"
+ },
+ {
+ "type": "patreon",
+ "url": "https://patreon.com/mdevils"
+ }
+ ],
+ "license": "MIT"
+ },
"node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
@@ -851,6 +1310,20 @@
"node": ">=8.0.0"
}
},
+ "node_modules/http-proxy-agent": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz",
+ "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==",
+ "license": "MIT",
+ "dependencies": {
+ "@tootallnate/once": "2",
+ "agent-base": "6",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/http-server": {
"version": "14.1.1",
"resolved": "https://registry.npmjs.org/http-server/-/http-server-14.1.1.tgz",
@@ -947,6 +1420,18 @@
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
"integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g=="
},
+ "node_modules/is-stream": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@@ -969,6 +1454,36 @@
"node": ">=10"
}
},
+ "node_modules/json-bigint": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
+ "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
+ "license": "MIT",
+ "dependencies": {
+ "bignumber.js": "^9.0.0"
+ }
+ },
+ "node_modules/jwa": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",
+ "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-equal-constant-time": "^1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/jws": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz",
+ "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==",
+ "license": "MIT",
+ "dependencies": {
+ "jwa": "^2.0.0",
+ "safe-buffer": "^5.0.1"
+ }
+ },
"node_modules/long": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
@@ -1302,6 +1817,21 @@
"opener": "bin/opener-bin.js"
}
},
+ "node_modules/p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "license": "MIT",
+ "dependencies": {
+ "yocto-queue": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -1421,6 +1951,29 @@
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
},
+ "node_modules/retry": {
+ "version": "0.13.1",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
+ "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/retry-request": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-7.0.2.tgz",
+ "integrity": "sha512-dUOvLMJ0/JJYEn8NrpOaGNE7X3vpI5XlZS/u0ANjqtcZVKnIxP7IgCFwrKTxENw29emmwug53awKtaMm4i9g5w==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/request": "^2.48.8",
+ "extend": "^3.0.2",
+ "teeny-request": "^9.0.0"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
@@ -1630,6 +2183,21 @@
"node": ">= 0.8"
}
},
+ "node_modules/stream-events": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz",
+ "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==",
+ "license": "MIT",
+ "dependencies": {
+ "stubs": "^3.0.0"
+ }
+ },
+ "node_modules/stream-shift": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.3.tgz",
+ "integrity": "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==",
+ "license": "MIT"
+ },
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@@ -1667,6 +2235,24 @@
"node": ">=8"
}
},
+ "node_modules/strnum": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.1.2.tgz",
+ "integrity": "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/NaturalIntelligence"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/stubs": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz",
+ "integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==",
+ "license": "MIT"
+ },
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -1694,6 +2280,35 @@
"node": ">=10"
}
},
+ "node_modules/teeny-request": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-9.0.0.tgz",
+ "integrity": "sha512-resvxdc6Mgb7YEThw6G6bExlXKkv6+YbuzGg9xuXxSgxJF7Ozs+o8Y9+2R3sArdWdW8nOokoQb1yrpFB0pQK2g==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "http-proxy-agent": "^5.0.0",
+ "https-proxy-agent": "^5.0.0",
+ "node-fetch": "^2.6.9",
+ "stream-events": "^1.0.5",
+ "uuid": "^9.0.0"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/teeny-request/node_modules/uuid": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
+ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@@ -1720,6 +2335,12 @@
"node": ">= 0.6"
}
},
+ "node_modules/undici-types": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
+ "license": "MIT"
+ },
"node_modules/union": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz",
@@ -1759,6 +2380,15 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
+ "node_modules/uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
@@ -1809,6 +2439,18 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
+ },
+ "node_modules/yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
}
}
}
diff --git a/package.json b/package.json
index 526afd1..781a2ec 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,6 @@
{
"dependencies": {
+ "@google-cloud/storage": "^7.16.0",
"amqplib": "^0.10.8",
"bcrypt": "^5.1.1",
"cors": "^2.8.5",
diff --git a/src/controllers/home.ctrl.js b/src/controllers/home.ctrl.js
index 7703c35..ce2b9d8 100644
--- a/src/controllers/home.ctrl.js
+++ b/src/controllers/home.ctrl.js
@@ -1,14 +1,7 @@
"use strict"
const University = require("../models/University");
-//const Partner = require("../models/Partner");
-// const User = require("../models/User");
-// const Council = require("../models/Council");
-// const Post = require("../models/Post");
-// const sendEmailWithAuthorization = require("../../mailer");
-// const bcrypt = require('bcrypt');
-// const Comment = require('../models/Comment');
-// const { getLatestPosts } = require("../public/js/post/post");
+const { sendUniversityURL, sendUniversityID, receiveUniversityData } = require('../rabbit/rabbitMQ');
const output = {
home: (req, res) => {
@@ -31,42 +24,70 @@ const mainpage = {
//council 페이지
const council = {
- getUniversityName: async (req, res) => {
- console.log("home.ctrl의 getUniversityName ");
- const university = new University();
- const response = await university.getUniversityName(req.body.university_url);
- console.log(response);
- return res.json(response);
- }
-}
+ getUniversityID: async (req, res) => {
+ try {
+ console.log("home.ctrl의 getUniversityID ");
+ const university_url = req.body.university_url;
+ await sendUniversityURL(university_url, 'SendUniversityID');
+ const university_id = await receiveUniversityData('RecvStartUniversityID');
+ console.log("home: university id:", university_id);
+
+ await sendUniversityID(university_id, 'SendPostList');
+ const post_info = await receiveUniversityData('RecvPostList');
+ console.log('home post_info: ', post_info.post_info);
+ const result = post_info.post_info;
+ console.log('home result: ', result);
+
+ return res.json({result});
+ } catch (err) {
+ console.log("getUniversityID error", err);
+ return res.status(500).json({ error: 'Internal Server Error' });
+ }
+ },
-// showUniversityNameList: async (req, res) => {
-// const university_name = new University();
-// const response = await university_name.showUniversityNameList();
-// return res.json(response);
-// },
+ getCardNewsImageUrl: async (req, res) => {
+ console.log("home.ctrl의 getImages");
+ const university_id = req.body.university_id;
+ await sendUniversityID(university_id, 'SendPostList');
-// getUniversityName: async (req, res) => {
-// const council = new Council();
-// const response = await council.getUniversityName(req.body.university_url);
-// return res.json(response);
-// },
+ const post_info = await receiveUniversityData('RecvPostList');
+ console.log("home: post info:", post_info);
+ return post_info;
+ },
+
+ getUniversityName: async (req, res) => {
+ try {
+ console.log("home.ctrl의 getUniversityName ");
+ const university_url = req.body.university_url;
+ //rabbitMQ로 user-service에 university_name, id 요청
+ await sendUniversityURL(university_url, 'SendUniversityName');
-// getCardNewsImageUrl: async (req, res) => {
-// const council = new Council();
-// const response = await council.getUniversityID(req.body.university_url);
-// const response2 = await council.getCardNewsImageUrl(response);
-// return res.json(response2);
-// },
+ //데이터 수신
+ const university_name = await receiveUniversityData('RecvStartUniversityName');
+ console.log("home: university name:", university_name.university_name);
+ return res.json(university_name);
-// getUniversityLocation: async (req, res) => {
-// const partner = new Partner();
-// const university_id = await partner.getUniversityID(req.body.university_url);
-// const response = await partner.getUniversityLocation(university_id);
-// return res.json(response);
-// },
-// }
+ } catch (err) {
+ console.error('getUniversityName error:', err);
+ return res.status(500).json({ error: 'Internal Server Error' });
+ }
+ },
+ getUniversityLocation: async (req, res) => {
+ try {
+ console.log("home.ctrl의 getUniversityLocation ");
+ const university_url = req.body.university_url;
+ await sendUniversityURL(university_url, 'SendUniversityLocation');
+ const university_location = await receiveUniversityData('RecvStartUniversityLocation');
+
+ console.log("home: university location:", university_location);
+ return res.json(university_location);
+ } catch (err) {
+ console.error('getUniversityLocation error:', err);
+ return res.status(500).json({ error: 'Internal Server Error' });
+ }
+ }
+}
module.exports = {
output,
diff --git a/src/models/University.js b/src/models/University.js
index 1d5f8e3..9a0b1d2 100644
--- a/src/models/University.js
+++ b/src/models/University.js
@@ -15,12 +15,23 @@ class University{
}
}
- async getUnversityUrlToName(university_url){
- console.log("University.js의 getUnversityUrlToName\n");
- try{
- const response=await UniversityStorage.getUnversityUrlToName(university_id);
+ // rabbitMQ로 대체
+ // async getUnversityUrlToName(university_url){
+ // console.log("University.js의 getUnversityUrlToName\n");
+ // try{
+ // const response=await UniversityStorage.getUnversityUrlToName(university_url);
+ // return response;
+ // }catch(err){
+ // return{success:false,msg:err};
+ // }
+ // }
+
+ async getImages(university_url) {
+ console.log("University.js의 getImages\n");
+ try {
+ const response = await UniversityStorage.loadImages(university_url);
return response;
- }catch(err){
+ } catch (err) {
return{success:false,msg:err};
}
}
diff --git a/src/models/UniversityStorage.js b/src/models/UniversityStorage.js
index 11da25f..4eb15ff 100644
--- a/src/models/UniversityStorage.js
+++ b/src/models/UniversityStorage.js
@@ -1,6 +1,7 @@
"use strict"
const { pool } = require("../config/db");
+
class UniversityStorage {
//모든 대학 정보 가져오기
static getUniversityName() {
@@ -24,27 +25,102 @@ class UniversityStorage {
})
}
- static getUnversityUrlToName(university_url) {
- console.log("UniversityStorage.js의 getUnversityUrlToName")
- return new Promise(async (resolve, reject) => {
- pool.getConnection((err, connection) => {
- if (err) {
- console.error('getUnversityName MySQL 연결 오류: ', err);
- reject(err)
- }
- const query = "SELECT university_name FROM University WHERE university_url =?;";
- pool.query(query, [university_id], (err, data) => {
- connection.release();
- if (err) reject(`${err}`);
+ // rabbitMQ로 대체
+ // static getUnversityUrlToName(university_url) {
+ // console.log("UniversityStorage.js의 getUnversityUrlToName")
+ // return new Promise(async (resolve, reject) => {
+ // pool.getConnection((err, connection) => {
+ // if (err) {
+ // console.error('getUnversityName MySQL 연결 오류: ', err);
+ // reject(err)
+ // }
+ // const query = "SELECT university_name FROM University WHERE university_url =?;";
+ // pool.query(query, [university_url], (err, data) => {
+ // connection.release();
+ // if (err) reject(`${err}`);
- else {
- resolve(data[0].university_name);
- }
- });
- })
- })
+ // else {
+ // resolve(data[0].university_name);
+ // }
+ // });
+ // })
+ // })
+ // }
+
+ //이미지 정보 넘기
+ static async loadImages(postId) {
+ console.log("UniversityStorage의 loadImages");
+ return new Promise((resolve, reject) => {
+ pool.getConnection(async (err, connection) => {
+ if(err) return reject(err);
+
+ try {
+ //post랑 통신해서 post_id, img_url 받아와야 해서 일단 하드코딩 해뒀음
+ const imageData = [
+ {
+ image_url: "https://storage.googleapis.com/uniunity_bucket/고양이이미지.png",
+ post_id: 1
+ },
+ {
+ image_url: "https://storage.googleapis.com/uniunity_bucket/고양이이미지.png",
+ post_id: 2
+ },
+ {
+ image_url: "https://storage.googleapis.com/uniunity_bucket/고양이이미지.png",
+ post_id: 3
+ }
+ ];
+ resolve(imageData);
+
+ } catch (err) {
+ connection.release();
+ reject({ result: false, status: 500, err: `${err}` });
+ }
+ });
+ });
}
+ //게시글 등록시 post이미지 저장(클라우드 스토리지 사용방식으로 변경)
+ // static async saveImagePost(postId, postInfo, formattedDateTime) {
+ // return new Promise((resolve, reject) => {
+ // pool.getConnection(async (err, connection) => {
+ // if (err) return reject(err);
+
+ // try {
+ // const post_id = postId;
+
+ // // src="data:image/..." 태그에서 base64 이미지 추출
+ // const regex = //gi;
+ // const matches = postInfo.match(regex);
+
+ // if (!matches || matches.length === 0) {
+ // connection.release();
+ // return resolve({ result: true, status: 201 });
+ // }
+
+ // // 첫 번째 이미지만 처리 (여러 개 저장 원하면 반복문으로 확장 가능)
+ // const base64Image = matches[0].match(/src="([^"]+)"/)[1];
+ // const base64Data = base64Image.replace(/^data:image\/\w+;base64,/, "");
+ // const buffer = Buffer.from(base64Data, "base64");
+
+ // const uploadedUrl = await uploadImageToGCS(buffer, `post_${post_id}.jpg`);
+
+ // const imageQuery = 'INSERT INTO PostImage(image_id, post_id, image_url, image_date) VALUES (?, ?, ?, ?);';
+ // connection.query(imageQuery, [null, post_id, uploadedUrl, formattedDateTime], (imageErr) => {
+ // connection.release();
+ // if (imageErr) {
+ // return reject({ result: false, status: 500, err: `${imageErr}` });
+ // }
+ // return resolve({ result: true, status: 201 });
+ // });
+ // } catch (err) {
+ // connection.release();
+ // reject({ result: false, status: 500, err: `${err}` });
+ // }
+ // });
+ // });
+ // }
+
// university_id받아 university_name반환하기
// static getUnversityName(university_id) {
diff --git a/src/public/js/apiUrl.js b/src/public/js/apiUrl.js
index a8c0071..7c1b97e 100644
--- a/src/public/js/apiUrl.js
+++ b/src/public/js/apiUrl.js
@@ -1,3 +1,8 @@
-// config.js
-console.log("apiUrl.js 연결") //테스트용 로그
-const apiUrl = 'http://34.47.84.123:3001';
+export const apiUrl = 'http://34.22.87.148:3001';
+
+// 마이크로서비스별 API 주소
+export const baseUrls = {
+ post: "http://34.22.87.148:3000",
+ partner: "http://34.22.87.148:3003",
+ user: "http://34.22.87.148:3004"
+};
diff --git a/src/public/js/council.js b/src/public/js/council.js
index c22caf4..f0a269e 100644
--- a/src/public/js/council.js
+++ b/src/public/js/council.js
@@ -1,7 +1,7 @@
-//import loadKakaoMap from '/js/kakaomapLoader.js';
-//import apiKeys from './apiKey.js';
-
-console.log("council.js 시작1"); //테스트용 로그
+import loadKakaoMap from '/js/kakaomapLoader.js';
+import apiKeys from './apiKey.js';
+import { apiUrl } from '/js/apiUrl.js';
+import { baseUrls } from './apiUrl.js';
//로그인(로그아웃), 회원가입(마이페이지)버튼
const loginStatusBtn = document.getElementById("loginStatusBtn");
@@ -14,7 +14,69 @@ const user_name = document.getElementById("user_name");
const university_name = document.getElementById("university_name");
const navBar=document.getElementById("navbar");
-console.log("council.js 시작"); //테스트용 로그
+//auth 로그인 정보 가져오기
+let userInfo;
+const userApiUrl = baseUrls.user;
+const postApiUrl = baseUrls.post;
+const postReactionApiUrl = baseUrls.postReaction;
+
+// 로그아웃 처리 함수
+const handleLogout = async () => {
+ try {
+ const res = await fetch(`${userApiUrl}/auth/logout`, {
+ method: "POST",
+ credentials: "include"
+ });
+
+ if (res.ok) {
+ // 로그아웃 성공 시 페이지 새로고침
+ window.location.reload(); // 또는 window.location.href = "/";
+ } else {
+ const data = await res.json();
+ alert(data.message || "로그아웃에 실패했습니다.");
+ }
+ } catch (err) {
+ console.error("로그아웃 요청 중 오류 발생:", err);
+ alert("서버 오류로 로그아웃에 실패했습니다.");
+ }
+};
+
+// 작성자 회원 정보 불러오기
+const loadloginData = async () => {
+ const res = await fetch(`${userApiUrl}/auth/me`, {
+ credentials: "include", // 쿠키 포함
+ });
+ if (res.ok == true){
+ loginStatusBtn.innerText = "로그아웃"
+ loginStatusBtn.removeAttribute("href"); // 기본 링크 제거
+ loginStatusBtn.addEventListener("click", (e) => {
+ e.preventDefault(); // 링크 동작 막기
+ handleLogout(); // 로그아웃 요청
+ });
+ signUpBtn.setAttribute("href", `${postReactionApiUrl}/mypage`);
+ signUpBtn.innerText = "마이페이지"
+ } else {
+ loginStatusBtn.setAttribute("href", `${userApiUrl}/auth/login`);
+ loginStatusBtn.innerText = "로그인"
+ signUpBtn.setAttribute("href", `${userApiUrl}/user/agreement`);
+ signUpBtn.innerText = "회원가입"
+ }
+ const data = await res.json();
+ userInfo = data;
+};
+
+// const loadloginData = async () => {
+// const res = await fetch(`${userApiUrl}/auth/logout`, {
+// credentials: "include", // 쿠키 포함
+// });
+
+// userInfo = await res.json(); // 유저 정보가 저장되는 변수
+// };
+
+// 페이지 로드 후 로그인 정보 획득
+// window.addEventListener('DOMContentLoaded', function () {
+// loadloginData();
+// });
//회원로그인 정보 불러오기
// const loadloginData = () => {
@@ -45,24 +107,31 @@ console.log("council.js 시작"); //테스트용 로그
// }
-// 로드 후 loadData()실행
-// window.addEventListener('DOMContentLoaded', function () {
-// loadloginData();
-// });
+// university_url 값을 받아오는 함수
+// function getUniversityUrl() {
+// // 현재 페이지의 URL에서 경로(pathname) 부분을 추출
+// const path = window.location.pathname;
+
+// // 경로에서 universityUrl 값을 추출
+// const pathParts = path.split('/');
+// const universityUrl = pathParts[pathParts.length - 1];
+// console.log("universityUrl: ", universityUrl);
+// return universityUrl;
+// }
+// var current_university_url = getUniversityUrl();
+
+//const url = new URL(window.location.href);
+// const universityUrl = url.pathname.split('/').pop();
+// return universityUrl;
// university_url 값을 받아오는 함수
function getUniversityUrl() {
- // 현재 페이지의 URL에서 경로(pathname) 부분을 추출
- const path = window.location.pathname;
-
- // 경로에서 universityUrl 값을 추출
- const pathParts = path.split('/');
- const universityUrl = pathParts[pathParts.length - 1];
- console.log("universityUrl: ", universityUrl);
+ const url = new URL(window.location.href);
+ const universityUrl = url.pathname.split('/').pop();
return universityUrl;
}
-var university_url = getUniversityUrl();
+var current_university_url = getUniversityUrl();
function setCenter(map,latitude,longitude){
// 이동할 위도 경도 위치를 생성합니다
@@ -75,18 +144,49 @@ function setCenter(map,latitude,longitude){
const serviceKey = apiKeys.SERVICE_KEY;
const endPoint = apiKeys.ENDPOINT;
-document.addEventListener("DOMContentLoaded", () => {
+document.addEventListener("DOMContentLoaded", async () => {
+ var university_location = [];
+ const universityUrl = current_university_url;
+ const req = {
+ university_url: universityUrl
+ };
+
+ try {
+ const res = await fetch(`${apiUrl}/getUniversityLocation`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(req),
+ });
+
+ const data = await res.json();
+ university_location[0] = data.latitude;
+ university_location[1] = data.longitude;
+ } catch (err) {
+ console.error("지도 정보 요청 중 에러:", err);
+ }
+ console.log("university_location[0]: ", university_location[0]);
+ console.log("university_location[1]: ", university_location[1]);
+
loadKakaoMap().then(() => {
const container = document.getElementById('map');
if (!container) return console.error('#map 요소가 없습니다.');
- const map = new kakao.maps.Map(container, {
- center: new kakao.maps.LatLng(37.59169598260442, 127.02220971655647), // 초기 위치
- level: 3
- });
+ let map;
+ if (university_location.length == 0) {
+ map = new kakao.maps.Map(container, {
+ center: new kakao.maps.LatLng(37.59169598260442, 127.02220971655647), // 초기 위치
+ level: 3
+ });
+ }
+ else {
+ map = new kakao.maps.Map(container, {
+ center: new kakao.maps.LatLng(university_location[0], university_location[1]), // 초기 위치
+ level: 3
+ });
+ }
- // setCenter();
- // bounds_changed 이벤트 등록
kakao.maps.event.addListener(map, 'bounds_changed', () => {
const bounds = map.getBounds();
const swLatlng = bounds.getSouthWest();
@@ -146,7 +246,6 @@ document.addEventListener("DOMContentLoaded", () => {
// 슬라이더 정보
var mySwiper;
function setSwiper() {
- console.log("setSwiper 시작"); //테스트용 로그
mySwiper = new Swiper('.swiper-container', {
wrapperClass: 'swiper-wrapper',
slideClass: 'swiper-slide',
@@ -164,11 +263,12 @@ function setSwiper() {
const universityName = document.querySelector("#universityName");
var Uniname = [];
-var university_id;
+var current_university_id;
var imageUrls = [];
// 카드뉴스 이미지 추가 함수
async function fetchImageUrls(imageData) {
+ console.log('fetchImageUrls 시작');
try {
const swiperWrapper = document.querySelector('.swiper-wrapper');
@@ -181,20 +281,20 @@ async function fetchImageUrls(imageData) {
for (let i = 0; i <= imageData.length - 1; i++) {
const currentData = imageData[i]; // 현재 이미지 데이터
// 이미지 데이터의 형태가 객체인지 확인
- if (currentData && currentData.image_url) {
+ if (currentData && currentData.img_url) {
//console.log(imageUrls.length);
- imageUrls.push(currentData.image_url); // 이미지를 배열에 추가
+ imageUrls.push(currentData.img_url); // 이미지를 배열에 추가
const imgContainer = document.createElement('div');
imgContainer.classList.add('swiper-slide');
const imgLink = document.createElement('a');
- imgLink.href = `${apiUrl}/postviewer/${currentData.post_id}`; // 이미지 클릭 시 postviewer 페이지로 이동하는 URL 생성
+ imgLink.href = `${postApiUrl}/postviewer/${currentData.post_id}`; // 이미지 클릭 시 postviewer 페이지로 이동하는 URL 생성
imgLink.target = '_self';
const imgElement = document.createElement('img');
imgElement.classList.add('news');
- imgElement.src = currentData.image_url;
+ imgElement.src = currentData.img_url;
imgElement.alt = 'no_image' + imageUrls.length;
imgLink.appendChild(imgElement);
@@ -212,9 +312,9 @@ async function fetchImageUrls(imageData) {
}
}
-function councilLoad() {
- console.log("councilLoad 시작"); //테스트용 로그
- const universityUrl = getUniversityUrl();
+//1. url -> name
+function nameLoad() {
+ const universityUrl = current_university_url;
const req = {
university_url: universityUrl
};
@@ -228,33 +328,41 @@ function councilLoad() {
})
.then((res) => res.json())
.then(res => {
- console.log("universityName: ", res.universityName); //테스트용 로그
+ console.log("councilLoad universityInfo: ", res);
Uniname.push(res.university_name);
universityName.innerHTML = Uniname[0];
});
- // .then(() => {
- // return fetch(`${apiUrl}/getCardNewsImageUrl`, {
- // method: "POST",
- // headers: {
- // "Content-Type": "application/json",
- // },
- // body: JSON.stringify(req),
- // });
- // })
- // .then((res) => res.json())
- // .then((imageData) => { // 이미지 데이터를 변수 imageData로 받아옴
- // fetchImageUrls(imageData); // 이미지 데이터를 fetchImageUrls 함수의 인자로 전달
- // })
- // .catch(error => {
- // console.error('Error:', error);
- // });
+}
+
+//url -> id -> image
+function imageLoad() {
+ const universityUrl = current_university_url;
+ const req = {
+ university_url: universityUrl
+ };
+
+ fetch(`${apiUrl}/getUniversityID`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(req),
+ })
+ .then((res) => res.json())
+ .then((data) => {
+ console.log("getimage: ", data);
+ console.log("imageLoad test1: ", data.result);
+ console.log("imageLoad test2: ", data.result[0].img_url);
+ fetchImageUrls(data.result);
+ });
}
window.addEventListener('DOMContentLoaded', function() {
setSwiper();
updateDynamicLinks();
- councilLoad();
- // retailerLoad();
+ loadloginData();
+ nameLoad();
+ imageLoad();
});
@@ -322,32 +430,36 @@ function getDynamicValueFromURL() {
// 새로운 url 만들기
function generateDynamicURL(linkId, userschool) {
var dynamicValue;
+ var next_url;
// linkId에 따라 동적 값을 할당하는 로직을 구현합니다.
if (linkId === "retailer") {
dynamicValue = "retailer/" + userschool;
+ next_url = baseUrls.partner;
} else if (linkId === "partner") {
dynamicValue = "partner/" + userschool;
+ next_url = baseUrls.partner;
} else if (linkId === "more_news") {
dynamicValue = "showPostListAll/" + userschool;
+ next_url = baseUrls.post;
} else if (linkId === "more_retailer") {
dynamicValue = "retailer/" + userschool;
+ next_url = baseUrls.partner;
} else if (linkId === "news") {
dynamicValue = "showPostListAll/" + userschool;
+ next_url = baseUrls.post;
}
- return `${apiUrl}/` + dynamicValue;
+ return `${next_url}/` + dynamicValue;
}
// 새로운 url로 업데이트
async function updateDynamicLinks() {
- console.log("updateDynamicLinks 시작"); //테스트용 로그
var userschool = getDynamicValueFromURL();
if (!userschool) {
console.log("영어 문자열이 URL에서 추출되지 않았습니다.");
return;
}
- console.log("userschool: ", userschool); //테스트용 로그
var link1 = document.getElementById("main_retailer");
var link2 = document.getElementById("partner");
@@ -385,3 +497,4 @@ async function updateDynamicLinks() {
window.location.href = link;
});
}
+
diff --git a/src/public/js/mainpage.js b/src/public/js/mainpage.js
index 8c20821..d7a4a5d 100644
--- a/src/public/js/mainpage.js
+++ b/src/public/js/mainpage.js
@@ -9,39 +9,88 @@ const navBar=document.getElementById("navbar-brand");
let universitySearchList = [];
-console.log("mainpage.js 시작");
-const loadData = async () => {
- console.log("loadData 실행");
- const url = `${apiUrl}/showUniversityNameList`;
- console.log(url, "\n");
- try {
- const res = await fetch(url);
- const data = await res.json();
- console.log(data);
-
- if (data.success === true) {
- console.log("data.success!\n");
- searchUniversityName(data.result); // 리스트 저장
- console.log("universitySearchList: \n");
- console.log(universitySearchList);
- } else {
- ul.innerHTML = "