From ce2be6b5bd670efdd4942a0826773de2088d517d Mon Sep 17 00:00:00 2001 From: Sangwook Park <41150708+sw0501@users.noreply.github.com> Date: Mon, 4 Dec 2023 23:24:56 +0900 Subject: [PATCH 1/2] Feature/backend (#190) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Modify: CI/CD 수정 * Feat: navigation API 개발 완료 * Modify: navigation API 수정 * Fix: navigation API 예외처리 * Feat: CORS http 포트 추가 * Modify: CORS 옵션 수정 * Modify: CORS 옵션 수정 --- BackendJS/BackendTS/server.js | 2 +- BackendTS/server.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BackendJS/BackendTS/server.js b/BackendJS/BackendTS/server.js index 100a757..1c6e34a 100644 --- a/BackendJS/BackendTS/server.js +++ b/BackendJS/BackendTS/server.js @@ -37,7 +37,7 @@ const busdata_1 = __importDefault(require("./routes/busdata")); const subwaydata_1 = __importDefault(require("./routes/subwaydata")); const navigation_1 = __importDefault(require("./routes/navigation")); let corsOptions = { - origin: ['http://localhost:3000/#/', 'http://localhost:3000', 'http://localhost:3005', 'http://34.168.80.42:3000', 'http://172.30.1.35:5000', 'http://localhost:5000', 'http://localhost:80'], + origin: ['http://localhost:3000/#/', 'http://localhost:3000', 'http://localhost:3005', 'http://34.168.80.42:3000', 'http://172.30.1.35:5000', 'http://localhost:5000', 'http://localhost:80', 'http://localhost:80/#/', 'http://www.easy-taza.site'], credentials: true }; app.use((0, cors_1.default)(corsOptions)); diff --git a/BackendTS/server.ts b/BackendTS/server.ts index 5f8ae08..f33985b 100644 --- a/BackendTS/server.ts +++ b/BackendTS/server.ts @@ -13,7 +13,7 @@ import subwayRouter from './routes/subwaydata'; import navigationRouter from './routes/navigation'; let corsOptions: cors.CorsOptions = { - origin: ['http://localhost:3000/#/', 'http://localhost:3000', 'http://localhost:3005', 'http://34.168.80.42:3000', 'http://172.30.1.35:5000', 'http://localhost:5000', 'http://localhost:80', 'http://localhost:80/#/'], + origin: ['http://localhost:3000/#/', 'http://localhost:3000', 'http://localhost:3005', 'http://34.168.80.42:3000', 'http://172.30.1.35:5000', 'http://localhost:5000', 'http://localhost:80', 'http://localhost:80/#/', 'http://www.easy-taza.site'], credentials: true } From 6253633e3d217444dfa83d3fa4c019e04f6fc125 Mon Sep 17 00:00:00 2001 From: Sangwook Park <41150708+sw0501@users.noreply.github.com> Date: Tue, 5 Dec 2023 00:42:57 +0900 Subject: [PATCH 2/2] Feature/backend (#191) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Modify: CI/CD 수정 * Feat: navigation API 개발 완료 * Modify: navigation API 수정 * Fix: navigation API 예외처리 * Feat: CORS http 포트 추가 * Modify: CORS 옵션 수정 * Modify: CORS 옵션 수정 * Feat: https 서버 업데이트 --- BackendJS/BackendTS/server.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/BackendJS/BackendTS/server.js b/BackendJS/BackendTS/server.js index 1c6e34a..ed98d36 100644 --- a/BackendJS/BackendTS/server.js +++ b/BackendJS/BackendTS/server.js @@ -31,11 +31,17 @@ const app = (0, express_1.default)(); const port = 3005; const path_1 = __importDefault(require("path")); const cors_1 = __importDefault(require("cors")); +const fs_1 = __importDefault(require("fs")); +const https_1 = __importDefault(require("https")); const db = __importStar(require("./db")); db.connect(); const busdata_1 = __importDefault(require("./routes/busdata")); const subwaydata_1 = __importDefault(require("./routes/subwaydata")); const navigation_1 = __importDefault(require("./routes/navigation")); +const httpsOptions = { + key: fs_1.default.readFileSync('./KEY/rootca.key'), + cert: fs_1.default.readFileSync('./KEY/rootca.crt') +}; let corsOptions = { origin: ['http://localhost:3000/#/', 'http://localhost:3000', 'http://localhost:3005', 'http://34.168.80.42:3000', 'http://172.30.1.35:5000', 'http://localhost:5000', 'http://localhost:80', 'http://localhost:80/#/', 'http://www.easy-taza.site'], credentials: true @@ -45,17 +51,20 @@ app.use(express_1.default.static(path_1.default.join(__dirname, '../../Backend/F app.use('/bus', busdata_1.default); app.use('/subway', subwaydata_1.default); app.use('/navigation', navigation_1.default); -app.get('/', (req, res) => { - res.sendFile(path_1.default.join(__dirname, '../../Backend/Frontend/creative/build/index.html')); -}); app.get('/', (req, res) => { res.json({ success: true, }); }); +const HTTPS_PORT = 3005; +https_1.default.createServer(httpsOptions, app).listen(HTTPS_PORT, () => { + console.log(`server is listening at localhost:${HTTPS_PORT}`); +}); +/* app.listen(port, () => { console.log(`server is listening at localhost:${port}`); -}); +}) +*/ //10분 주기로 MySQL Connection 유지용 쿼리 보내기 const mysql_Connect_Maintenance = setInterval(() => { const connection = db.return_connection();