-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
83 lines (74 loc) · 1.86 KB
/
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
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
'use strict';
module.exports = function(app) {
var tableRoute = [
[],//data
["Routes", "MethodType"]//fields
];
/**
* Method for create routes
* @param {*} exp
*/
const _ = function(exp) {
var split = exp.split(' ');
var methodType = split[0];
var route = split[1];
var s = split[2].split('.').filter(x => !!x);
var func = s[s.length - 1].split('(')[0];
var classe = '.' + s[0];
var resourceController = require(classe);
tableRoute[0].push({ Routes: route, MethodType: methodType });
resourceController[func](app, methodType, route);
};
/** START ROUTE DECLARATION ZONE */
/**
* @swagger
* /stats:
* get:
* summary: Hub Stats
* tags:
* - name: Hub
* responses:
* 200:
* description: Success
* 404:
* description: Authentication failed
* 500:
* description: Server Error
*/
_("GET /stats ./exposition/controllers/PriceResourceController.stats()");
/**
* @swagger
* /challenges/{address}:
* get:
* summary: Challenges Stats
* tags:
* - name: Hub
* responses:
* 200:
* description: Success
* 404:
* description: Authentication failed
* 500:
* description: Server Error
*/
_("GET /challenges/:address ./exposition/controllers/ChallengesResourceController.challenges()");
/**
* @swagger
* /ladder:
* get:
* summary: Ladder Stats
* tags:
* - name: Hub
* responses:
* 200:
* description: Success
* 404:
* description: Authentication failed
* 500:
* description: Server Error
*/
_("GET /ladder ./exposition/controllers/ChallengesResourceController.ladder()");
/** END ROUTE DECLARATION ZONE */
tableRoute[0] = tableRoute[0].sort((a, b) => a.Routes > b.Routes ? 1 : -1);
console.table(tableRoute[0], tableRoute[1]);
};