|
@ -30,6 +30,7 @@ var userMdl = require('./models/userModel')(app, mongoose); |
|
|
var userCtrl = require('./controllers/userController'); |
|
|
var userCtrl = require('./controllers/userController'); |
|
|
|
|
|
|
|
|
var travelMdl = require('./models/travelModel')(app, mongoose); |
|
|
var travelMdl = require('./models/travelModel')(app, mongoose); |
|
|
|
|
|
var joinMdl = require('./models/joinModel')(app, mongoose); |
|
|
var travelCtrl = require('./controllers/travelController'); |
|
|
var travelCtrl = require('./controllers/travelController'); |
|
|
|
|
|
|
|
|
/*// Example Route |
|
|
/*// Example Route |
|
@ -70,6 +71,8 @@ apiRoutes.route('/travels') |
|
|
|
|
|
|
|
|
apiRoutes.route('/travels/:id') |
|
|
apiRoutes.route('/travels/:id') |
|
|
.get(travelCtrl.findById); |
|
|
.get(travelCtrl.findById); |
|
|
|
|
|
apiRoutes.route('/travels/join/:travelId') |
|
|
|
|
|
.get(travelCtrl.getJoinsByTravelId); |
|
|
|
|
|
|
|
|
// OJU AQUÏ TREC la verificació de token temporalment, per fer les proves des de l'app
|
|
|
// OJU AQUÏ TREC la verificació de token temporalment, per fer les proves des de l'app
|
|
|
// route middleware to verify a token
|
|
|
// route middleware to verify a token
|
|
@ -116,6 +119,9 @@ apiRoutes.route('/travels/:id') |
|
|
.put(travelCtrl.updateTravel) |
|
|
.put(travelCtrl.updateTravel) |
|
|
.delete(travelCtrl.deleteTravel); |
|
|
.delete(travelCtrl.deleteTravel); |
|
|
|
|
|
|
|
|
|
|
|
apiRoutes.route('/travels/join/:id') |
|
|
|
|
|
.post(travelCtrl.addJoin); |
|
|
|
|
|
|
|
|
app.use('/api', apiRoutes); |
|
|
app.use('/api', apiRoutes); |
|
|
// end of API routes -------------------------------------
|
|
|
// end of API routes -------------------------------------
|
|
|
|
|
|
|
|
|