I'm using nodemailer to verify user's email when they sign up. It sends out an email with a link (something like localhost:3000/verify/?id=##).
When they click the link, it works and I can see a GET request has been made.
GET /verify/?id=141 200 2.582 ms - 4638
I tried this:
api.get('/verify/?id=', function(req, res) {
console.log('verify request has been made'); // doesn't log on console
})
And I also tried this:
api.get('/verify', function(req, res) {
console.log(req.query.id);
console.log(req.param.id);
})
based on answers to questions I'd seen answered here and elsewhere, but nothing gets logged.
Also, I'm using Angular (with ngRoute) so it might be something going on on the frontend too, but I'm new to MEAN stack and don't know where to begin.
edit Here's the front-end:
app.routes.js
angular.module('appRoutes', ['ngRoute'])
.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'app/views/pages/map.html',
controller: 'MainController',
})
.when('/verify/:username', {
templateUrl: 'app/verify/verify.html',
controller: 'verifyController'
})
$locationProvider.html5Mode({ enabled: true, requireBase: false });;
})
verifyController.js
angular.module('verifyController', ['verifySerivice'])
.controller('verifyController', function($routeParams, verify){
console.log('in verify controller');
var id = $routeParams.id;
verify.verifyUser(id);
})
verifyService.js
angular.module('verifyService', [])
.factory('verify', function($http) {
var verifyFactory = {};
verifyFactory.verifyUser = function(id) {
console.log('verify service accessed');
return $http.get('/verify', id)
.then(handleSuccess, handleError);
}
return verifyFactory;
})