2014-05-12 20:08:19 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-03 23:42:17 +02:00
|
|
|
angular.module('ffffng').factory('Router', function (
|
|
|
|
app,
|
2016-06-26 20:21:45 +02:00
|
|
|
VersionResource,
|
2016-07-19 13:24:43 +02:00
|
|
|
StatisticsResource,
|
2016-06-07 14:08:04 +02:00
|
|
|
FrontendResource,
|
2016-06-03 23:42:17 +02:00
|
|
|
NodeResource,
|
|
|
|
MonitoringResource,
|
2016-06-11 12:08:50 +02:00
|
|
|
TaskResource,
|
2017-05-06 18:40:59 +02:00
|
|
|
MailResource,
|
|
|
|
config
|
2016-06-03 23:42:17 +02:00
|
|
|
) {
|
2014-05-12 20:08:19 +02:00
|
|
|
return {
|
|
|
|
init: function () {
|
2017-05-06 18:40:59 +02:00
|
|
|
var express = require('express');
|
|
|
|
var router = express.Router();
|
2016-06-07 14:08:04 +02:00
|
|
|
|
2017-05-06 18:40:59 +02:00
|
|
|
router.post('/', FrontendResource.render);
|
2016-06-26 22:00:58 +02:00
|
|
|
|
2017-05-06 18:40:59 +02:00
|
|
|
router.get('/api/version', VersionResource.get);
|
2016-05-18 22:50:06 +02:00
|
|
|
|
2017-05-06 18:40:59 +02:00
|
|
|
router.post('/api/node', NodeResource.create);
|
|
|
|
router.put('/api/node/:token', NodeResource.update);
|
|
|
|
router.delete('/api/node/:token', NodeResource.delete);
|
|
|
|
router.get('/api/node/:token', NodeResource.get);
|
2016-06-03 23:42:17 +02:00
|
|
|
|
2017-05-06 18:40:59 +02:00
|
|
|
router.put('/api/monitoring/confirm/:token', MonitoringResource.confirm);
|
|
|
|
router.put('/api/monitoring/disable/:token', MonitoringResource.disable);
|
2016-07-19 13:24:43 +02:00
|
|
|
|
2017-05-06 18:40:59 +02:00
|
|
|
router.get('/internal/api/statistics', StatisticsResource.get);
|
2016-06-07 00:21:26 +02:00
|
|
|
|
2017-05-06 18:40:59 +02:00
|
|
|
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);
|
2016-06-11 15:31:57 +02:00
|
|
|
|
2017-05-06 18:40:59 +02:00
|
|
|
router.get('/internal/api/monitoring', MonitoringResource.getAll);
|
2016-06-11 12:08:50 +02:00
|
|
|
|
2017-05-06 18:40:59 +02:00
|
|
|
router.get('/internal/api/mails', MailResource.getAll);
|
|
|
|
router.get('/internal/api/mails/:id', MailResource.get);
|
|
|
|
router.delete('/internal/api/mails/:id', MailResource.delete);
|
|
|
|
router.put('/internal/api/mails/reset/:id', MailResource.resetFailures);
|
|
|
|
|
|
|
|
router.put('/internal/api/nodes/:token', NodeResource.update);
|
|
|
|
router.delete('/internal/api/nodes/:token', NodeResource.delete);
|
|
|
|
router.get('/internal/api/nodes', NodeResource.getAll);
|
|
|
|
router.get('/internal/api/nodes/:token', NodeResource.get);
|
|
|
|
|
|
|
|
app.use(config.server.rootPath, router);
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|