-
Notifications
You must be signed in to change notification settings - Fork 1
/
routes.js
48 lines (41 loc) · 2.75 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
const passportConf = require('./config/passport');
const response = require('./nodejs/response');
// Controllers
const homeController = require('./controllers/home');
const userController = require('./controllers/user');
const appConfigController = require('./controllers/app-config');
const apiController = require('./controllers/api');
module.exports = (app) => {
app.get('/app-config/config', passportConf.isAuthenticated, appConfigController.getConfig);
app.post('/app-config/config', passportConf.isAuthenticated, appConfigController.saveConfig);
app.post('/app-config/run-app', passportConf.isAuthenticated, appConfigController.runApp);
app.post('/signin', userController.postSignin);
app.post('/logout', userController.logout);
app.post('/forgot', userController.postForgot);
app.post('/reset', userController.postReset);
app.post('/signup', userController.postSignup);
app.get('/account/profile', passportConf.isAuthenticated, userController.getProfile);
app.post('/account/profile', passportConf.isAuthenticated, userController.postUpdateProfile);
app.post('/account/password', passportConf.isAuthenticated, userController.postUpdatePassword);
app.post('/account/delete', passportConf.isAuthenticated, userController.postDeleteAccount);
app.get('/account/api-key', passportConf.isAuthenticated, userController.getNewApiKey);
app.post('/account/remove-api-key', passportConf.isAuthenticated, userController.removeApiKey);
app.get('/api/music', passportConf.validateApiToken, apiController.getMusic);
app.get('/api/goodreads-raw', passportConf.validateApiToken, apiController.getGoodreadsRaw);
app.get('/api/goodreads', passportConf.validateApiToken, apiController.getGoodreads);
app.get('/api/github', passportConf.validateApiToken, apiController.getGithub);
app.get('/api/allocation', passportConf.validateApiToken, apiController.getAllocation);
app.get('/api/trakt', passportConf.validateApiToken, apiController.getTrakt);
app.get('/api/states', passportConf.validateApiToken, apiController.getStates);
app.get('/api/countries', passportConf.validateApiToken, apiController.getCountries);
app.get('/api/parks', passportConf.validateApiToken, apiController.getParks);
app.get('/api/fuelly', passportConf.validateApiToken, apiController.getFuelly);
app.get('/api/fuelly-avg', passportConf.validateApiToken, apiController.getFuellyAvg);
app.get('/api/player-fm', passportConf.validateApiToken, apiController.getPlayerFm);
app.get('/api/instagram', passportConf.validateApiToken, apiController.getInstagram);
app.get('/api/*', (req, res) => {
response.notFound(res, `Requested API resource at '${req.path}' not found`);
});
// All requests that are not '/api/*' get sent the React page
app.get('*', homeController.getReactPage);
};