김연우

modify read_csv

Showing 1 changed file with 25 additions and 24 deletions
...@@ -129,7 +129,31 @@ app.post('/hook', function (req, res) { ...@@ -129,7 +129,31 @@ app.post('/hook', function (req, res) {
129 } 129 }
130 res.sendStatus(200); 130 res.sendStatus(200);
131 131
132 - chooseFile = function () { 132 +
133 + chooseFile();
134 +
135 +
136 +});
137 +
138 +try {
139 + const option = {
140 + ca: fs.readFileSync('/etc/letsencrypt/live/' + domain + '/fullchain.pem'),
141 + key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/privkey.pem'), 'utf8').toString(),
142 + cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/cert.pem'), 'utf8').toString(),
143 + };
144 +
145 + HTTPS.createServer(option, app).listen(sslport, () => {
146 + console.log(`[HTTPS] Server is started on port ${sslport}`);
147 + });
148 +} catch (error) {
149 + console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
150 + console.log(error);
151 +}
152 +
153 +const csv = require('csv-parser')
154 +const results = [];
155 +
156 +chooseFile = function () {
133 if (destCar == "cafe") { 157 if (destCar == "cafe") {
134 fs.createReadStream('cafe_list.csv') 158 fs.createReadStream('cafe_list.csv')
135 .pipe(csv()) 159 .pipe(csv())
...@@ -163,26 +187,3 @@ app.post('/hook', function (req, res) { ...@@ -163,26 +187,3 @@ app.post('/hook', function (req, res) {
163 }); 187 });
164 } 188 }
165 } 189 }
...\ No newline at end of file ...\ No newline at end of file
166 -
167 - chooseFile();
168 -
169 -
170 -});
171 -
172 -try {
173 - const option = {
174 - ca: fs.readFileSync('/etc/letsencrypt/live/' + domain + '/fullchain.pem'),
175 - key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/privkey.pem'), 'utf8').toString(),
176 - cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/cert.pem'), 'utf8').toString(),
177 - };
178 -
179 - HTTPS.createServer(option, app).listen(sslport, () => {
180 - console.log(`[HTTPS] Server is started on port ${sslport}`);
181 - });
182 -} catch (error) {
183 - console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
184 - console.log(error);
185 -}
186 -
187 -const csv = require('csv-parser')
188 -const results = [];
......