To debug try to comment out the static file middle-ware before curling the 
url.

It could be that there is another middle-ware that grabs the request before 
its possible for this route to respond.

On Wednesday, 15 January 2014 22:13:59 UTC+1, Tej Powar wrote:
>
> Hi
>
> I have a node.js application where I have used Yeoman scaffolding for 
> angular. I am also using expressjs for server side.
>
> So basically my app structure is 
>
> app
> -->views
> --> more files
> server.js
>
> The structure is more heavy than this but this is to keep it simple.
>
> Basically I have used passportjs on the server side for authentication. 
> The routing is currently being carried out via angularjs routing 
> parameters. 
>
> I have come across an issue now as i need to carry out authetication by 
> using middleware method:
>
> function ensureAuthenticated(req, res, next) {
>     console.log('authenticate=' + req.isAuthenticated());
>     if (req.isAuthenticated()) { return next(); }
>     res.redirect('/')
> }
>
> I have created a app.get on the server side to check if the users try to 
> get to the admin page without logging in
>
> app.get('/admin', ensureAuthenticated,
>     function(req, res){
>     console.log('get admin' + req.params);
>     res.sendfile(__dirname + '/app/views/admin/users.html');
> });  
>
> But it never goes to the method. Not sure what i am doing wrong?
>
> Any advice would be great
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to