3 var express = require('express');
4 var authMiddleware = require('../../web/middlewares/auth-api');
5 const env = require('gitter-web-env');
6 const identifyRoute = env.middlewares.identifyRoute;
7 const logger = env.logger;
8 var skipTokenErrorHandler = require('../../web/middlewares/skip-token-error-handler');
10 var router = express.Router({ caseSensitive: true, mergeParams: true });
13 router.get('/health_check', identifyRoute('api-private-health-check'), require('./health-check'));
18 identifyRoute('api-private-health-check-full'),
19 require('./health-check-full')
24 process.env.ENABLE_FIXTURE_ENDPOINTS &&
25 (process.env.NODE_ENV === 'dev' ||
26 process.env.NODE_ENV === 'test' ||
27 process.env.NODE_ENV === 'test-docker')
29 logger.warn('Fixtures endpoint is enabled!');
30 router.use('/fixtures', require('./fixtures'));
36 identifyRoute('api-private-github-repo-mirror'),
37 require('./github-mirror/repos-mirror')
43 identifyRoute('api-private-github-users-mirror'),
44 require('./github-mirror/users-mirror')
50 identifyRoute('api-private-github-user-search-mirror'),
51 require('./github-mirror/user-search-mirror')
54 // No auth for hooks yet
55 router.post('/hook/:hash', identifyRoute('api-private-hook'), require('./hooks'));
60 identifyRoute('api-private-irc-token'),
61 require('./irc-token')
67 identifyRoute('api-private-issue-mirror'),
68 require('./issue-mirror')
74 identifyRoute('api-private-issue-state'),
75 require('./issue-state')
79 '/generate-signature',
81 identifyRoute('api-private-transloadit-signature'),
82 require('./transloadit-signature')
87 '/transloadit/:token',
88 identifyRoute('api-private-transloadit-callback'),
89 require('./transloadit')
93 '/chat-heatmap/:roomId',
95 identifyRoute('api-private-chat-heatmap'),
96 require('./chat-heatmap')
100 '/orgs/:orgUri/members',
102 skipTokenErrorHandler,
103 identifyRoute('api-private-org-members'),
104 require('./org-members')
108 '/subscription/:userOrOrg',
109 identifyRoute('api-private-subscription-create'),
110 require('./subscription-created')
114 '/subscription/:userOrOrg',
115 identifyRoute('api-private-subscription-delete'),
116 require('./subscription-deleted')
119 router.post('/statsc', identifyRoute('api-private-statsc'), require('./statsc'));
121 router.get('/sample-chats', identifyRoute('api-private-sample-chats'), require('./sample-chats'));
126 identifyRoute('api-private-create-badge'),
127 require('./create-badge-pr')
130 // TODO: this should go...
132 '/user-avatar/:username',
133 identifyRoute('api-private-user-avatar'),
134 require('./user-avatar')
137 router.use('/avatars', require('./avatars'));
142 identifyRoute('api-private-markdown-preview'),
143 require('./markdown-preview')
147 '/inviteUserSuggestions',
149 identifyRoute('api-private-invite-user-suggestions'),
150 require('./invite-user-suggestions')
156 identifyRoute('api-private-check-invite'),
157 require('./check-invite')
163 identifyRoute('api-private-check-group-uri'),
164 require('./check-group-uri')
167 router.post('/fp', authMiddleware, identifyRoute('api-private-fp'), require('./fingerprint'));
172 identifyRoute('api-private-resolve'),
176 /* Web push registration endpoint */
177 router.post('/vapid', authMiddleware, identifyRoute('api-private-vapid'), require('./vapid'));
179 module.exports = router;