-
Notifications
You must be signed in to change notification settings - Fork 4
/
routes.js
38 lines (34 loc) · 1.49 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
'use strict';
const authRequired = require('./middleware/authRequired');
const pages = require('./controllers/pages');
const users = require('./controllers/users');
const quests = require('./controllers/quests');
const vk = require('./controllers/vk');
module.exports = function (app) {
app.get('/', pages.index);
app.get('/popular', pages.index);
app.post('/user/login', users.validate, users.login);
app.get('/auth-vk', vk.auth, users.loginVK);
app.post('/user/reg', users.validate, users.register);
app.post('/user/logout', users.logout);
app.get('/user/:name', pages.userPage);
app.get('/auth', pages.auth);
app.get('/reg', pages.reg);
app.post('/get-more-quests', pages.index);
app.post('/start-quest', authRequired, users.startQuest);
app.get('/quest/:name', quests.quest);
app.post('/quest/checkin', authRequired, quests.checkin);
app.post('/like-quest', quests.likeQuest);
app.post('/place-comment', authRequired, quests.addCommentToPlace);
app.post('/quest-comment', authRequired, quests.addCommentToQuest);
app.get('/create-quest', authRequired, pages.createQuest);
app.post('/create-quest', authRequired, quests.upload, quests.create);
app.post('/get-quest-titles', pages.getTitles);
app.get('/get-location-insta-photos/:lat/:lng', quests.instaPhotos);
app.get('/search', pages.search);
app.all('*', pages.error404);
app.use((err, req, res) => {
console.error(err);
res.sendStatus(500);
});
};