장주현

github 배포용으로 수정

Showing 1 changed file with 22 additions and 18 deletions
...@@ -4,11 +4,11 @@ const fs = require('fs'); ...@@ -4,11 +4,11 @@ const fs = require('fs');
4 const bodyParser = require('body-parser'); 4 const bodyParser = require('body-parser');
5 const app = express(); 5 const app = express();
6 const PAPAGO_URL = 'https://openapi.naver.com/v1/papago/n2mt' 6 const PAPAGO_URL = 'https://openapi.naver.com/v1/papago/n2mt'
7 -const PAPAGO_ID = 'cIZBOTfISMHEyygh_NHp'; 7 +const PAPAGO_ID = 'Client ID';
8 -const PAPAGO_SECRET = '8D32UNGgYp'; 8 +const PAPAGO_SECRET = 'Client Secret';
9 -const path = require('path'); 9 +//const path = require('path');
10 -const HTTPS = require('https'); 10 +//const HTTPS = require('https');
11 -const domain = "www.chatosscjh.tk" 11 +//const domain = "www.chatosscjh.tk"
12 const sslport = 23023; 12 const sslport = 23023;
13 13
14 //const indexRoute = require("./routes/index"); 14 //const indexRoute = require("./routes/index");
...@@ -218,17 +218,21 @@ function trans(message, totrans){ ...@@ -218,17 +218,21 @@ function trans(message, totrans){
218 }); 218 });
219 }; 219 };
220 220
221 -try { 221 +app.listen(sslport, function(){
222 - const option = { 222 + console.log('listen',sslport);
223 - ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
224 - key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(),
225 - cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(),
226 - };
227 -
228 - HTTPS.createServer(option, app).listen(sslport, () => {
229 - console.log(`[HTTPS] Server is started on port ${sslport}`);
230 }); 223 });
231 - } catch (error) { 224 +
232 - console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); 225 +//try {
233 - console.log(error); 226 +// const option = {
234 - } 227 +// ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
228 +// key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(),
229 +// cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(),
230 +// };
231 +//
232 +// HTTPS.createServer(option, app).listen(sslport, () => {
233 +// console.log(`[HTTPS] Server is started on port ${sslport}`);
234 +// });
235 +// } catch (error) {
236 +// console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
237 +// console.log(error);
238 +// }
......