-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
67 lines (55 loc) · 1.48 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
65
66
67
const express = require("express");
const bodyParser = require("body-parser");
const uuid = require("uuid");
const app = express();
const PORT = process.env.PORT ?? 3000;
app.use(bodyParser.json());
app.get("/", (req, res) => {
res.send("Hello world");
});
app.post("/assessment.list", (req, res) => {
console.log("Called assessment.list");
res.json({
success: true,
results: [
{
assessment_type_id: "1",
name: "synonyms",
description: "proste synonyma",
},
{
assessment_type_id: "2",
name: "dependencies",
description: "default assignment",
},
],
});
});
app.post("/assessment.start", (req, res) => {
console.log(req.body);
const assessment_id = uuid.v4();
console.log(`Called assessment.start, new assessment ID: ${assessment_id}`);
res.json({
success: true,
results: {
assessment_id,
_comment: "some comment",
update_request: {
timestamp: new Date().getTime(),
assessment_id,
assessment_status: {
identifier: "assignment_status",
value: "not_started",
type: "string",
label: "Assignment status",
},
},
},
});
});
app.post("/assessment.cancel", (req, res) => {
const { assessment_id } = req.body;
console.log(`Called assessment.cancel on ${assessment_id}`);
res.json({ success: true, results: { assessment_id } });
});
app.listen(PORT, () => console.log(`App running on port ${PORT}`));