장주현

github 배포용으로 수정

Showing 1 changed file with 23 additions and 19 deletions
......@@ -4,11 +4,11 @@ const fs = require('fs');
const bodyParser = require('body-parser');
const app = express();
const PAPAGO_URL = 'https://openapi.naver.com/v1/papago/n2mt'
const PAPAGO_ID = 'cIZBOTfISMHEyygh_NHp';
const PAPAGO_SECRET = '8D32UNGgYp';
const path = require('path');
const HTTPS = require('https');
const domain = "www.chatosscjh.tk"
const PAPAGO_ID = 'Client ID';
const PAPAGO_SECRET = 'Client Secret';
//const path = require('path');
//const HTTPS = require('https');
//const domain = "www.chatosscjh.tk"
const sslport = 23023;
//const indexRoute = require("./routes/index");
......@@ -218,17 +218,21 @@ function trans(message, totrans){
});
};
try {
const option = {
ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(),
cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(),
};
HTTPS.createServer(option, app).listen(sslport, () => {
console.log(`[HTTPS] Server is started on port ${sslport}`);
});
} catch (error) {
console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
console.log(error);
}
app.listen(sslport, function(){
console.log('listen',sslport);
});
//try {
// const option = {
// ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
// key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(),
// cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(),
// };
//
// HTTPS.createServer(option, app).listen(sslport, () => {
// console.log(`[HTTPS] Server is started on port ${sslport}`);
// });
// } catch (error) {
// console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
// console.log(error);
// }
......