Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bluejoyq
/
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-23 14:59:48 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6f1813ccf2aa06b35ffef709ac13ae9e28b76e5d
6f1813cc
1 parent
d374d787
api try catch - clienddata and analyzeData
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
api/cliConnection.js
api/cliConnection.js
View file @
6f1813c
...
...
@@ -10,15 +10,37 @@ const machineRead = require("./machineRead");
const
cliConnection
=
async
(
req
,
res
)
=>
{
let
clientData
=
{},
analyzeData
=
{},
searchData
=
[];
clientData
=
req
.
body
.
data
;
//clientData = req.body.data;
try
{
clientData
=
req
.
body
.
data
;
//clientData = req.body.data;
if
(
!
clientData
.
text
.
replace
(
/
\s
/g
,
''
).
length
)
{
throw
new
Error
(
"client text empty"
);
}
}
catch
(
err
)
{
console
.
log
(
err
);
res
.
json
(
{
"return_code"
:
-
1
,
"error_code"
:
err
.
message
}
);
res
.
status
(
403
);
return
false
;
}
try
{
analyzeData
=
await
textAnalytic
(
clientData
);
}
catch
(
err
)
{
console
.
log
(
err
);
res
.
json
(
{
"return_code"
:
-
1
,
"error_code"
:
err
.
message
}
);
res
.
status
(
502
);
return
false
;
}
analyzeData
=
await
textAnalytic
(
clientData
);
// searchData try catch
analyzeData
.
searchResults
=
searchData
;
res
.
send
({
return_code
:
0
,
return_data
:
analyzeData
});
res
.
status
(
200
);
};
module
.
exports
=
cliConnection
;
module
.
exports
=
cliConnection
;
\ No newline at end of file
...
...
Please
register
or
login
to post a comment