This question already has an answer here:
First of all, i am newbie in node.js. I'm trying to load board.html after a post request using passport.js for authentication which works well. The problem is that node loads the page incomplete( images missing, canvas not working and so on). Note that if i run board.html directly to browser it works perfectly.
index.html
<form method="post" action="/createRoom" >
<div id="insertCode">
<input type="text" class="typeCode" name="roomName"
placeholder="code">
<button type="submit" class="orange"></button>
</div>
</form>
app.js
function checkAuthentication(req,res,next){
if(req.isAuthenticated()) {
console.log('authenticated');
next();
} else{
console.log('not_authenticated');
res.redirect("/login.html");
}
}
app.post('/createRoom', checkAuthentication,function(req,res){
console.log(req.isAuthenticated());
res.redirect('board.html');
})
app.get('*',function(req,res){
console.log('404');
res.redirect("/404.html");
});
console
authenticated
true
404
404
404
...
Any ideas; Thanks in advance
via user3649152
No comments:
Post a Comment