diff --git a/controllers/travelController.js b/controllers/travelController.js index ec0c95f..d80d2b7 100644 --- a/controllers/travelController.js +++ b/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) { diff --git a/server.js b/server.js index 30a2835..42fe423 100755 --- a/server.js +++ b/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