Toggle navigation
Toggle navigation
This project
Loading...
Sign in
서민정
/
SEARCH-AND-CHAT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
서민정
2020-05-13 01:35:00 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0b6c3ef06267d5248ba13ee2b41eb519b52c83a7
0b6c3ef0
1 parent
48c74530
Update route
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
index.js
server/routes/dialogflow.js
index.js
View file @
0b6c3ef
...
...
@@ -6,6 +6,22 @@ const app = express();
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
app
.
use
(
bodyParser
.
json
());
app
.
use
(
'/api/dialogflow'
,
require
(
'./server/routes/dialogflow'
));
// Serve static assets if in production
if
(
process
.
env
.
NODE_ENV
===
"production"
)
{
// Set static folder
app
.
use
(
express
.
static
(
"client/build"
));
// index.html for all page routes
app
.
get
(
"*"
,
(
req
,
res
)
=>
{
res
.
sendFile
(
path
.
resolve
(
__dirname
,
"client"
,
"build"
,
"index.html"
));
});
}
const
port
=
process
.
env
.
PORT
||
5000
;
app
.
listen
(
port
,
()
=>
{
console
.
log
(
`Server Running at
${
port
}
`
)
});
...
...
server/routes/dialogflow.js
View file @
0b6c3ef
const
express
=
require
(
'express'
);
const
router
=
express
.
Router
();
const
dialogflow
=
require
(
'dialogflow'
);
const
config
=
require
(
'../config/keys'
);
const
projectId
=
config
.
googleProjectID
const
sessionId
=
config
.
dialogFlowSessionID
const
languageCode
=
config
.
dialogFlowSessionLanguageCode
// Create a new session
const
sessionClient
=
new
dialogflow
.
SessionsClient
();
const
sessionPath
=
sessionClient
.
sessionPath
(
projectId
,
sessionId
);
//Text Query Route
// Event Query Route
module
.
exports
=
router
;
\ No newline at end of file
...
...
Please
register
or
login
to post a comment