Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김서영
/
searchGuide
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김서영
2019-11-25 11:48:15 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
59c7661ff9def5eff4712f06ed969cdcddd2685a
59c7661f
1 parent
b7e2eed8
handling searchdata and trycatch
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
api/cliConnection.js
api/cliConnection.js
View file @
59c7661
...
...
@@ -12,9 +12,9 @@ const cliConnection = async (req, res) => {
analyzeData
=
{},
searchData
=
[];
// clientData
try
{
clientData
=
req
.
body
.
data
;
//clientData = req.body.data;
if
(
!
clientData
.
text
.
replace
(
/
\s
/g
,
''
).
length
)
{
throw
new
Error
(
"client text empty"
);
}
...
...
@@ -26,6 +26,7 @@ const cliConnection = async (req, res) => {
return
false
;
}
// analyzeData
try
{
analyzeData
=
await
textAnalytic
(
clientData
);
}
...
...
@@ -36,7 +37,17 @@ const cliConnection = async (req, res) => {
return
false
;
}
// searchData try catch
// searchData
searchData
=
searchData
[
0
].
concat
(
searchData
[
1
]
);
try
{
searchData
=
await
machineRead
(
searchData
,
analyzeData
.
keywordText
);
}
catch
(
err
)
{
console
.
log
(
err
);
res
.
json
(
{
"return_code"
:
-
1
,
"error_code"
:
err
.
message
}
);
res
.
status
(
502
);
return
false
;
}
analyzeData
.
searchResults
=
searchData
;
res
.
send
({
return_code
:
0
,
return_data
:
analyzeData
});
...
...
Please
register
or
login
to post a comment