Compare commits

...

5 Commits

Author SHA1 Message Date
cefd78f422 [] DB 연결 테스트 코드 작성
Some checks failed
Stein_Back/pipeline/head This commit looks good
Back/pipeline/head There was a failure building this commit
2024-08-09 16:31:33 +09:00
6a7fa38b96 [] RT 서비스 연결 추가
All checks were successful
Stein_Back/pipeline/head This commit looks good
2024-08-09 15:49:59 +09:00
ec547ae098 [👷]Jenkins' docker container has been changed.
All checks were successful
Stein_Back/pipeline/head This commit looks good
2024-07-15 16:47:53 +09:00
e44d9c660c [👷] Jenkins Test4
All checks were successful
Stein_Back/pipeline/head This commit looks good
2024-07-12 18:03:42 +09:00
c671d2cc96 [👷] Jenkins Test3
All checks were successful
Stein_Back/pipeline/head This commit looks good
2024-07-12 18:00:23 +09:00
4 changed files with 42 additions and 1 deletions

2
Jenkinsfile vendored
View File

@ -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
View 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
View 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
});
};

View File

@ -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'));