Toggle navigation
Toggle navigation
This project
Loading...
Sign in
신원형
/
study-or-enjoy
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김연우
2022-06-05 20:43:17 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
058f4a1edbc1e6fa10b0222f9fa5ba359b218221
058f4a1e
1 parent
8b408a2e
modify read_csv.js
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
42 deletions
read_csv.js
read_csv.js
View file @
058f4a1
const
csv
=
require
(
'csv-parser'
)
const
fs
=
require
(
'fs'
)
const
results
=
[];
var
choice
=
"놀거리"
//대분류 선택 과정 필요
exports
.
chooseFile
=
function
()
{
if
(
choice
==
"카페"
)
{
fs
.
createReadStream
(
'cafe_list.csv'
)
.
pipe
(
csv
())
.
on
(
'data'
,
(
data
)
=>
results
.
push
(
data
))
.
on
(
'end'
,
()
=>
{
console
.
log
(
results
);
});
}
else
if
(
choice
==
"식사"
)
{
fs
.
createReadStream
(
'meal_list.csv'
)
.
pipe
(
csv
())
.
on
(
'data'
,
(
data
)
=>
results
.
push
(
data
))
.
on
(
'end'
,
()
=>
{
console
.
log
(
results
);
});
}
else
if
(
choice
==
"놀거리"
)
{
fs
.
createReadStream
(
'play_list.csv'
)
.
pipe
(
csv
())
.
on
(
'data'
,
(
data
)
=>
results
.
push
(
data
))
.
on
(
'end'
,
()
=>
{
console
.
log
(
results
);
});
}
else
if
(
choice
==
"술집"
)
{
fs
.
createReadStream
(
'bar_list.csv'
)
.
pipe
(
csv
())
.
on
(
'data'
,
(
data
)
=>
results
.
push
(
data
))
.
on
(
'end'
,
()
=>
{
console
.
log
(
results
);
});
}
}
//chatbot - reply - app.js
var
express
=
require
(
'express'
);
const
request
=
require
(
'request'
);
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/reply'
const
TOKEN
=
'MNiReWsDC5DyJeehZ2gHoqlEVjPsno4ScaswBgXNz0lAVW3v2JizZzhF97DPKxe23jduB+YCcBum+KredegXZnxnrovFVt4fEmgeivWgxOzt/AEJ292DZfPn3uW7xrWfBZrlGXDLaL1AMIBlmwSCcwdB04t89/1O/w1cDnyilFU='
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"2021105581.osschatbot2022.tk"
const
sslport
=
23023
;
var
first
=
false
;
//첫 시도인지
var
second
=
false
;
//첫번째 분류 선택했는지
...
...
@@ -161,6 +128,45 @@ app.post('/hook', function (req, res) {
}
}
res
.
sendStatus
(
200
);
chooseFile
=
function
()
{
if
(
destCar
==
"cafe"
)
{
fs
.
createReadStream
(
'cafe_list.csv'
)
.
pipe
(
csv
())
.
on
(
'data'
,
(
data
)
=>
results
.
push
(
data
))
.
on
(
'end'
,
()
=>
{
console
.
log
(
results
);
});
}
else
if
(
destCar
==
"meal"
)
{
fs
.
createReadStream
(
'meal_list.csv'
)
.
pipe
(
csv
())
.
on
(
'data'
,
(
data
)
=>
results
.
push
(
data
))
.
on
(
'end'
,
()
=>
{
console
.
log
(
results
);
});
}
else
if
(
destCar
==
"play"
)
{
fs
.
createReadStream
(
'play_list.csv'
)
.
pipe
(
csv
())
.
on
(
'data'
,
(
data
)
=>
results
.
push
(
data
))
.
on
(
'end'
,
()
=>
{
console
.
log
(
results
);
});
}
else
if
(
destCar
==
"bar"
)
{
fs
.
createReadStream
(
'bar_list.csv'
)
.
pipe
(
csv
())
.
on
(
'data'
,
(
data
)
=>
results
.
push
(
data
))
.
on
(
'end'
,
()
=>
{
console
.
log
(
results
);
});
}
}
chooseFile
();
});
try
{
...
...
@@ -177,3 +183,6 @@ try {
console
.
log
(
'[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'
);
console
.
log
(
error
);
}
const
csv
=
require
(
'csv-parser'
)
const
results
=
[];
...
...
Please
register
or
login
to post a comment