Showing
1 changed file
with
20 additions
and
9 deletions
1 | -var express = require('express'); | ||
2 | -var app = express(); | ||
3 | -const line = require('@line/bot-sdk'); | ||
4 | var createServer = require("auto-sni"); | 1 | var createServer = require("auto-sni"); |
5 | - | 2 | +var express = require("express"); |
6 | - | 3 | +var app = express(); |
7 | -createServer({ email: "sweun1@naver.com", domains: ["www.oss.chatbot.bu.to","oss.chatbot.bu.to"], agreeTos: true }, app);// https | 4 | +const line = require('@line/bot-sdk'); |
8 | -console.log("1"); | ||
9 | -//papago api | ||
10 | var request = require('request'); | 5 | var request = require('request'); |
11 | 6 | ||
7 | +const lex = require('greenlock-express').create({ | ||
8 | + version: 'draft-11', // 버전2 | ||
9 | + configDir: '/etc/letsencrypt', // 또는 ~/letsencrypt/etc | ||
10 | + approveDomains: (opts, certs, cb) => { | ||
11 | + if (certs) { | ||
12 | + opts.domains = ['oss.chatbot.bu.to', 'oss.chatbot.bu.to']; | ||
13 | + } else { | ||
14 | + opts.email = 'sweun1@naver.com'; | ||
15 | + opts.agreeTos = true; | ||
16 | + } | ||
17 | + cb(null, { options: opts, certs }); | ||
18 | + }, | ||
19 | + renewWithin: 81 * 24 * 60 * 60 * 1000, | ||
20 | + renewBy: 80 * 24 * 60 * 60 * 1000, | ||
21 | +});//papago api | ||
22 | + | ||
23 | +https.createServer(lex.httpsOptions, lex.middleware(app)).listen(process.env.SSL_PORT || 443); | ||
12 | //번역 api_url | 24 | //번역 api_url |
13 | var translate_api_url = 'https://openapi.naver.com/v1/papago/n2mt'; | 25 | var translate_api_url = 'https://openapi.naver.com/v1/papago/n2mt'; |
14 | 26 | ||
... | @@ -26,7 +38,6 @@ const config = { | ... | @@ -26,7 +38,6 @@ const config = { |
26 | 38 | ||
27 | }; | 39 | }; |
28 | 40 | ||
29 | - | ||
30 | // create LINE SDK client | 41 | // create LINE SDK client |
31 | const client = new line.Client(config); | 42 | const client = new line.Client(config); |
32 | // create Express app | 43 | // create Express app | ... | ... |
-
Please register or login to post a comment