2020-04-08 03:19:55 +02:00
|
|
|
import express from "express"
|
|
|
|
|
2020-06-30 01:10:18 +02:00
|
|
|
import {app} from "./app"
|
2020-04-08 03:19:55 +02:00
|
|
|
import {config} from "./config"
|
|
|
|
|
2022-05-19 13:33:48 +02:00
|
|
|
import * as ConfigResource from "./resources/configResource"
|
2020-04-09 20:18:13 +02:00
|
|
|
import * as VersionResource from "./resources/versionResource"
|
2020-04-10 00:43:15 +02:00
|
|
|
import * as StatisticsResource from "./resources/statisticsResource"
|
2020-04-09 20:18:13 +02:00
|
|
|
import * as FrontendResource from "./resources/frontendResource"
|
2020-04-10 00:43:15 +02:00
|
|
|
import * as NodeResource from "./resources/nodeResource"
|
|
|
|
import * as MonitoringResource from "./resources/monitoringResource"
|
2020-04-09 20:18:13 +02:00
|
|
|
import * as TaskResource from "./resources/taskResource"
|
2020-04-10 00:43:15 +02:00
|
|
|
import * as MailResource from "./resources/mailResource"
|
2020-04-08 03:19:55 +02:00
|
|
|
|
|
|
|
export function init (): void {
|
|
|
|
const router = express.Router();
|
|
|
|
|
|
|
|
router.post('/', FrontendResource.render);
|
|
|
|
|
2022-05-19 13:33:48 +02:00
|
|
|
router.get('/api/config', ConfigResource.get);
|
2020-04-08 03:19:55 +02:00
|
|
|
router.get('/api/version', VersionResource.get);
|
|
|
|
|
|
|
|
router.post('/api/node', NodeResource.create);
|
|
|
|
router.put('/api/node/:token', NodeResource.update);
|
2020-04-10 00:43:15 +02:00
|
|
|
router.delete('/api/node/:token', NodeResource.remove);
|
2020-04-08 03:19:55 +02:00
|
|
|
router.get('/api/node/:token', NodeResource.get);
|
|
|
|
|
|
|
|
router.put('/api/monitoring/confirm/:token', MonitoringResource.confirm);
|
|
|
|
router.put('/api/monitoring/disable/:token', MonitoringResource.disable);
|
|
|
|
|
|
|
|
router.get('/internal/api/statistics', StatisticsResource.get);
|
|
|
|
|
|
|
|
router.get('/internal/api/tasks', TaskResource.getAll);
|
|
|
|
router.put('/internal/api/tasks/run/:id', TaskResource.run);
|
|
|
|
router.put('/internal/api/tasks/enable/:id', TaskResource.enable);
|
|
|
|
router.put('/internal/api/tasks/disable/:id', TaskResource.disable);
|
|
|
|
|
|
|
|
router.get('/internal/api/monitoring', MonitoringResource.getAll);
|
|
|
|
|
|
|
|
router.get('/internal/api/mails', MailResource.getAll);
|
|
|
|
router.get('/internal/api/mails/:id', MailResource.get);
|
2020-04-10 00:43:15 +02:00
|
|
|
router.delete('/internal/api/mails/:id', MailResource.remove);
|
2020-04-08 03:19:55 +02:00
|
|
|
router.put('/internal/api/mails/reset/:id', MailResource.resetFailures);
|
|
|
|
|
|
|
|
router.put('/internal/api/nodes/:token', NodeResource.update);
|
2020-04-10 00:43:15 +02:00
|
|
|
router.delete('/internal/api/nodes/:token', NodeResource.remove);
|
2020-04-08 03:19:55 +02:00
|
|
|
router.get('/internal/api/nodes', NodeResource.getAll);
|
|
|
|
router.get('/internal/api/nodes/:token', NodeResource.get);
|
|
|
|
|
|
|
|
app.use(config.server.rootPath, router);
|
|
|
|
}
|