-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.js
88 lines (66 loc) · 2.63 KB
/
server.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const express = require("express");
const path = require("path");
const StepFunctionsAPI = require("./backend/StepFunctionsAPI");
const APIType = require("./util/APIType");
const app = express();
const port = 3000;
app.use(express.json());
app.post("/api/create-activity", function(req, res) {
StepFunctionsAPI.call(APIType.CREATE_ACTIVITY, req, res);
});
app.post("/api/create-state-machine", function(req, res) {
StepFunctionsAPI.call(APIType.CREATE_STATE_MACHINE, req, res);
});
app.post("/api/delete-activity", function(req, res) {
StepFunctionsAPI.call(APIType.DELETE_ACTIVITY, req, res);
});
app.post("/api/delete-state-machine", function(req, res) {
StepFunctionsAPI.call(APIType.DELETE_STATE_MACHINE, req, res);
});
app.post("/api/describe-activity", function(req, res) {
StepFunctionsAPI.call(APIType.DESCRIBE_ACTIVITY, req, res);
});
app.post("/api/describe-execution", function(req, res) {
StepFunctionsAPI.call(APIType.DESCRIBE_EXECUTION, req, res);
});
app.post("/api/describe-state-machine", function(req, res) {
StepFunctionsAPI.call(APIType.DESCRIBE_STATE_MACHINE, req, res);
});
app.post("/api/get-activity-task", function(req, res) {
StepFunctionsAPI.call(APIType.GET_ACTIVITY_TASK, req, res);
});
app.post("/api/get-execution-history", function(req, res) {
StepFunctionsAPI.call(APIType.GET_EXECUTION_HISTORY, req, res);
});
app.post("/api/list-activities", function(req, res) {
StepFunctionsAPI.call(APIType.LIST_ACTIVITIES, req, res);
});
app.post("/api/list-executions", function(req, res) {
StepFunctionsAPI.call(APIType.LIST_EXECUTIONS, req, res);
});
app.post("/api/list-state-machines", function(req, res) {
StepFunctionsAPI.call(APIType.LIST_STATE_MACHINES, req, res);
});
app.post("/api/list-tags-for-resource", function(req, res) {
StepFunctionsAPI.call(APIType.LIST_TAGS_FOR_RESOURCE, req, res);
});
app.post("/api/send-task-success", function(req, res) {
StepFunctionsAPI.call(APIType.SEND_TASK_SUCCESS, req, res);
});
app.post("/api/send-task-failure", function(req, res) {
StepFunctionsAPI.call(APIType.SEND_TASK_FAILURE, req, res);
});
app.post("/api/send-task-heartbeat", function(req, res) {
StepFunctionsAPI.call(APIType.SEND_TASK_HEARTBEAT, req, res);
});
app.post("/api/start-execution", function(req, res) {
StepFunctionsAPI.call(APIType.START_EXECUTION, req, res);
});
app.post("/api/stop-execution", function(req, res) {
StepFunctionsAPI.call(APIType.STOP_EXECUTION, req, res);
});
app.use(express.static("build"));
app.get("*", (req, res) => {
res.sendFile(path.join(__dirname + "/build/index.html"));
});
app.listen(port, () => console.log(`Example app listening on port ${port}!`));