-
Notifications
You must be signed in to change notification settings - Fork 3
/
routes.js
41 lines (34 loc) · 1.87 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
const reviewsRequests = require('./controllers/reviewsRequests');
const questionsRequests = require('./controllers/questionsRequests');
const relatedRequests = require('./controllers/relatedRequests');
const overviewRequests = require('./controllers/overviewRequests');
const appRequests = require('./controllers/appRequests');
const router = require('express').Router();
// connect controller methods to their corresponding routes
// App routes
router.get('/app', appRequests.getCurrentProductInfo);
router.post('/interactions', appRequests.saveInteractionData);
//overview routes
router.get('/products/:product_id/styles', overviewRequests.getProductStyles);
router.get('/products/:product_id', overviewRequests.getCurrentProduct);
//question routes
router.get('/qa/questions', questionsRequests.getQuestions);
router.post('/qa/questions', questionsRequests.postQuestion);
router.post('/qa/questions/:question_id/answers', questionsRequests.postAnswer);
router.put('/qa/questions/:question_id/helpful', questionsRequests.markQuestionHelpful);
router.put('/qa/answers/:answer_id/helpful', questionsRequests.markAnswerHelpful);
router.put('/qa/answers/:answer_id/report', questionsRequests.reportAnswer);
router.post('/qa/photos', questionsRequests.postPhotos);
//related routes
router.get('/related', relatedRequests.getRelated);
router.post('/outfit', relatedRequests.addToOutfit);
router.get('/outfit', relatedRequests.getOutfit);
router.delete('/outfit', relatedRequests.removeFromOutfit);
//review routes
router.get('/reviews', reviewsRequests.getReviews);
router.get('/reviews/meta', reviewsRequests.getReviewMetadata);
router.post('/reviews', reviewsRequests.addReview);
router.put('/reviews/:review_id/helpful', reviewsRequests.markHelpful);
router.put('/reviews/:review_id/report', reviewsRequests.reportReview);
router.post('/reviews/photos', reviewsRequests.postPhotos);
module.exports = router;