From cefd78f422bb6ec32f6938ce7f5f37570d4d2ab2 Mon Sep 17 00:00:00 2001 From: "seonkyu.kim" Date: Fri, 9 Aug 2024 16:31:33 +0900 Subject: [PATCH] =?UTF-8?q?[=E2=9C=A8]=20DB=20=EC=97=B0=EA=B2=B0=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RT/app.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/RT/app.js b/RT/app.js index fa608df..9e72410 100644 --- a/RT/app.js +++ b/RT/app.js @@ -1,25 +1,19 @@ import express, { query } from 'express'; import { createDatabaseConnection } from '../db/database.js'; // db 연결 파일 -import { HandlePush } from './push.js'; -import { rtDBConfig } from '../private/config.js'; - -// const cmcd = "/JJ"; -// const db = "/JJ/db"; - -const app = express(); -app.use(express.json()); +import { rtDBConfig } from '../private/config.js'; // 프라이빗 파일 연결 +const router = express.Router(); // DB 연결 테스트 -app.get(`${db}/test`, async (req, res) => { +router.get(`/test`, async (req, res) => { try { - const connection = await createDatabaseConnection(dbConfig); + const connection = await createDatabaseConnection(rtDBConfig); const [rows] = await connection.query('SELECT * FROM version'); await connection.end(); - res.json({ result: rows[0].solution }); + res.json(rows); } catch (err) { res.status(500).json({ error: err.message }); } }); -export default app; \ No newline at end of file +export default router; \ No newline at end of file