초기 PM 소스 전체 업로드
This commit is contained in:
88
routes/mainRouter.js
Normal file
88
routes/mainRouter.js
Normal file
@@ -0,0 +1,88 @@
|
||||
const express = require('express');
|
||||
const process = require('process');
|
||||
const path = require('path');
|
||||
const router = express.Router();
|
||||
const { isLoggedIn } = require('../controllers/authController');
|
||||
const { getIo } = require('../socket');
|
||||
|
||||
const env = process.env;
|
||||
|
||||
//////// pm-bcmf 연결용 테스트 코드 - url pathname이 pm-bcmf로 들어온 경우 authController id, startPath 전역변수에 쿼리 내용 저장 후 main.html로 이동
|
||||
router.get('/pm-bcmf', async(req, res, next) => {
|
||||
req.body = {
|
||||
id: req.query.id,
|
||||
startPath: req.query.startPath
|
||||
};
|
||||
const authController = require('../controllers/authController');
|
||||
await authController.setBcmfUrlQuery(req, res);
|
||||
|
||||
res.sendFile(path.join(process.cwd(), `views/main/main.html`));
|
||||
})
|
||||
|
||||
router.get('/projectStatus'/* , isLoggedIn */ ,async(req, res, next) => {
|
||||
res.sendFile(path.join(process.cwd(), `views/index/index-projectStatus.html`));
|
||||
});
|
||||
|
||||
router.get(`/`/* , isLoggedIn */,(req,res,next)=>{
|
||||
|
||||
let html = ``;
|
||||
|
||||
// html = `views/index/index-bim.html`;
|
||||
// html = `views/index/index-overseas.html`;
|
||||
|
||||
if(env.SERVICE_NAME === 'PM_ver4_LOCAL' || env.SERVICE_NAME === 'PM_ver4_ONPREMISE') html = `views/index/index-onpremise.html`;
|
||||
if(env.SERVICE_NAME === 'PM_ver4_CLOUD_OVERSEAS'){
|
||||
if(req.hostname.toLowerCase().includes('gtb.')) html = `views/main/main.html`;
|
||||
// if(req.hostname.toLowerCase().includes('cheongyong.')) html = `views/main/main.html`;
|
||||
if(req.hostname.toLowerCase().includes('bim.')) html = `views/index/index-bim.html`;
|
||||
if(req.hostname.toLowerCase().includes('overseas.')) html = `views/index/index-overseas.html`;
|
||||
if(req.hostname.toLowerCase().includes('jangheon.')) html = `views/index/index-jangheon.html`;
|
||||
if(req.hostname.toLowerCase().includes('jangheonindustry.')) html = `views/index/index-jangheon.html`
|
||||
|
||||
// 아래는 로컬에서 테스트 할 때 사용 -> html 변수에 테스트 할 인덱스 페이지 경로 사용
|
||||
if(req.hostname.toLowerCase().includes('172') || req.hostname.toLowerCase().includes('localhost')) {
|
||||
//// 온프레미스
|
||||
html = `views/index/index-onpremise.html`;
|
||||
|
||||
//// 클라우드 bim
|
||||
// html = `views/index/index-bim.html`;
|
||||
|
||||
//// 클라우드 overseas
|
||||
// html = `views/index/index-overseas.html`;
|
||||
|
||||
//// 클라우드 jangheon
|
||||
// html = `views/index/index-jangheon.html`;
|
||||
|
||||
//// 클라우드 gtb, cheongyong
|
||||
// html = `views/main/main.html`;
|
||||
}
|
||||
}
|
||||
res.sendFile(path.join(process.cwd(), html));
|
||||
})
|
||||
|
||||
router.get('/:type'/* , isLoggedIn */ ,async(req, res, next) => {
|
||||
const { type } = req.params;
|
||||
|
||||
let html = ``;
|
||||
// if(env.SERVICE_NAME === 'PM_ver4_LOCAL' || env.SERVICE_NAME === 'PM_ver4_ONPREMISE') html = `views/index/list-onpremise-tdc.html`;
|
||||
// if(env.SERVICE_NAME === 'PM_ver4_CLOUD_JANGHEON') html = `views/index/index-jangheon.html`;
|
||||
// if(env.SERVICE_NAME === 'PM_ver4_CLOUD_OVERSEAS'){
|
||||
// if(req.hostname.toLowerCase().includes('gtb.')) html = `views/main/main.html`;
|
||||
// if(req.hostname.toLowerCase().includes('bim.')) html = `views/index/index-bim.html`;
|
||||
// if(req.hostname.toLowerCase().includes('overseas.')) html = `views/index/index-overseas.html`;
|
||||
// if(req.hostname.toLowerCase().includes('jangheon.')) html = `views/index/index-jangheon.html`;
|
||||
// }
|
||||
|
||||
// if(env.SERVICE_NAME === 'PM_ver4_LOCAL' || env.SERVICE_NAME === 'PM_ver4_ONPREMISE'){
|
||||
// if(type.toLowerCase() == 'tdc') res.redirect('/');
|
||||
// }
|
||||
if (type.toLowerCase() == 'popup'){
|
||||
html = 'views/main/popup.html';
|
||||
res.sendFile(path.join(process.cwd(), `${html}`));
|
||||
} else{
|
||||
res.redirect('/');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user