forked from hacker-alliance/UCFParkingAgent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
64 lines (52 loc) · 1.57 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const express = require('express');
const {
dialogflow,
Suggestions,
BasicCard,
Button,
SimpleResponse,
Image,
Table,
} = require('actions-on-google');
const bodyParser = require("body-parser");
const converter = require("number-to-words");
const format = require("string-template");
const moment = require("moment-timezone");
const helper = require("./lib/helper");
const lib = {
dialogflow,
Suggestions,
BasicCard,
Button,
SimpleResponse,
Image,
Table,
bodyParser,
converter,
format,
helper,
moment,
}
const IntentHandler = require("./intents/IntentHandler");
const app = dialogflow();
const restService = express();
restService.use(
bodyParser.urlencoded({
extended: true
})
);
restService.use(bodyParser.json());
//Garage Prediction Intent Handler
app.intent(IntentHandler["all_garage"][0],conv=>IntentHandler[IntentHandler["all_garage"][0]](conv,lib));
//Default Welcome Intent Handler
app.intent(IntentHandler["all_garage"][1],conv=>IntentHandler[IntentHandler["all_garage"][1]](conv,lib));
//Spots Left Intent Handler
app.intent(IntentHandler["all_garage"][2],conv=>IntentHandler[IntentHandler["all_garage"][2]](conv,lib));
//Spots Taken Intent Handler
app.intent(IntentHandler["all_garage"][3],conv=>IntentHandler[IntentHandler["all_garage"][3]](conv,lib));
//Garage Status Intent Handler
app.intent(IntentHandler["all_garage"][4],conv=>IntentHandler[IntentHandler["all_garage"][4]](conv,lib));
restService.post("/garage", app);
restService.listen(process.env.PORT || 8080, function() {
console.log("Server up and listening v3.1");
});