Browse Source

updated

master
arnaucode 7 years ago
parent
commit
7a2d12a22c
2 changed files with 6 additions and 5 deletions
  1. +1
    -0
      controllers/travelController.js
  2. +5
    -5
      server.js

+ 1
- 0
controllers/travelController.js

@ -20,6 +20,7 @@ exports.getAllTravels = function(req, res) {
exports.getTravelById = function (req, res) {
travelModel.findOne({_id: req.params.travelid})
.lean()
.populate('user', 'username avatar')
.populate('joins', 'username avatar')
.populate('comments', 'comment user')
.exec(function (err, travel) {

+ 5
- 5
server.js

@ -61,11 +61,11 @@ apiRoutes.route('/signup')
.post(userCtrl.signup);
apiRoutes.route('/users')
.get(userCtrl.getAllUsers);
apiRoutes.route('/users/getByUserId/:userid')
apiRoutes.route('/users/id/:userid')
.get(userCtrl.getUserById);
apiRoutes.route('/travels')
.get(travelCtrl.getAllTravels);
apiRoutes.route('/travels/getByTravelId/:travelid')
apiRoutes.route('/travels/id/:travelid')
.get(travelCtrl.getTravelById);
@ -107,21 +107,21 @@ apiRoutes.use(function(req, res, next) {
}); //fi verificació de token
apiRoutes.route('/users/getByToken')
apiRoutes.route('/users/token')
.get(userCtrl.getUserByToken);
apiRoutes.route('/users')//agafa l'user a partir del token
.put(userCtrl.updateUser)//no comprovat
.delete(userCtrl.deleteUser);
apiRoutes.route('/travels')
.post(travelCtrl.addTravel);
apiRoutes.route('/travels/modifyById/:travelid')
apiRoutes.route('/travels/id/modify/:travelid')
.put(travelCtrl.updateTravel)//no comprovat
.delete(travelCtrl.deleteTravel);
apiRoutes.route('/travels/join/:travelid')
.get(travelCtrl.addJoinPetition);
apiRoutes.route('/travels/unjoin/:travelid')
.get(travelCtrl.unJoin);
apiRoutes.route('/travels/getByUserId/:userid')
apiRoutes.route('/travels/byuser/id/:userid')
.get(travelCtrl.getTravelsByUserId);
//FINS AQUÏ COMPROVAT

Loading…
Cancel
Save