forked from chriskinsman/github-action-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
31 lines (26 loc) · 725 Bytes
/
routes.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
const debug = require("debug")("action-dashboard:routes");
class Routes {
constructor(actions, owner) {
this._owner = owner;
this._actions = actions;
}
attach(router) {
router.get("/owner", (req, res, next) => {
debug(`/owner ${this._owner}`);
res.send(this._owner);
});
router.get("/initialData", (req, res, next) => {
const initialData = this._actions.getInitialData();
res.send(initialData);
});
router.get("/runs/:owner/:repo/:workflow_id", (req, res, next) => {
this._actions.refreshWorkflow(
req.params.owner,
req.params.repo,
parseInt(req.params.workflow_id)
);
res.send();
});
}
}
module.exports = Routes;