Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
cefd78f422 | |||
6a7fa38b96 | |||
ec547ae098 | |||
e44d9c660c | |||
c671d2cc96 |
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
|
@ -22,7 +22,7 @@ pipeline {
|
|||
// 컨테이너 내부로 파일 복사
|
||||
sh "docker cp ${WORKSPACE}/. ${containerId}:${APP_VOLUME_FRONT}"
|
||||
// 컨테이너 재시작
|
||||
sh "docker restart ${containerId}"
|
||||
// sh "docker restart ${containerId}"
|
||||
} else {
|
||||
error "Docker container ${DOCKER_CONTAINER_NAME} not found"
|
||||
}
|
||||
|
|
19
RT/app.js
Normal file
19
RT/app.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
import express, { query } from 'express';
|
||||
import { createDatabaseConnection } from '../db/database.js'; // db 연결 파일
|
||||
import { rtDBConfig } from '../private/config.js'; // 프라이빗 파일 연결
|
||||
const router = express.Router();
|
||||
|
||||
|
||||
// DB 연결 테스트
|
||||
router.get(`/test`, async (req, res) => {
|
||||
try {
|
||||
const connection = await createDatabaseConnection(rtDBConfig);
|
||||
const [rows] = await connection.query('SELECT * FROM version');
|
||||
await connection.end();
|
||||
res.json(rows);
|
||||
} catch (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
16
db/database.js
Normal file
16
db/database.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
import mysql from 'mysql2/promise';
|
||||
|
||||
// 데이터베이스 연결 설정 함수
|
||||
export const createDatabaseConnection = (config) => {
|
||||
return mysql.createConnection({
|
||||
host: config.host,
|
||||
user: config.user,
|
||||
password: config.password,
|
||||
database: config.database,
|
||||
port: config.port,
|
||||
waitForConnections: true,
|
||||
connectionLimit: 10,
|
||||
queueLimit: 0
|
||||
});
|
||||
};
|
6
index.js
6
index.js
|
@ -4,6 +4,7 @@ import { fileURLToPath } from 'url';
|
|||
import cors from 'cors';
|
||||
import fetch from 'node-fetch';
|
||||
import session from 'express-session'; // express-session 추가
|
||||
import rtRoutes from './RT/app.js'; // ./RT/app.js에서 라우트를 가져옴
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
@ -29,6 +30,11 @@ app.use(express.static(path.join(__dirname, '..', 'front', 'login')));
|
|||
let sessionId = ''; // 세션 ID를 저장할 변수
|
||||
|
||||
|
||||
// ===== RT 설정 ===== //
|
||||
app.use('/RT', rtRoutes);
|
||||
|
||||
|
||||
|
||||
// login
|
||||
app.get('/login', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '..', 'front', 'login', 'login.html'));
|
||||
|
|
Loading…
Reference in New Issue
Block a user