Tuesday 6 June 2017

nodejs expressjs sendFile with angular resource

I have my index.html, when I click on a button, it calls a angular service that use $resource.

var serviceRest = $resource(URL_API, null,
    {
       "connect" : { method: "GET", url: "http://localhost/login"}
     });

And then in my expressJS route I have this :

router.get('/',function(req,res){
    console.log("Hi there");
    res.sendFile('../public/login.html', {root: __dirname});
});

But it does nothing. Nothing happens but my console log display so my sendFile might be false... I stay on my index.html.

My router file is in ./controllers, and my login.html is in ./public/views



via Krakito

No comments:

Post a Comment