Ich versuche, Abfrage nach 'status.html' wie localhost:3000/status.html?channel="string that I want to get"
zu bekommen.Versuch, Abfrage in App.get-Funktion mit Express in node.js
Also schrieb ich den Code wie folgt.
app.get('/status.html', isLoggedIn, function(res, req){
if (req.query.channel){
if (req.isAuthenticated()){
res.redirect('/status');
}else{
console.log("Please Log in to access to this webpage");
res.redirect('/login');
}
}
});
Es ist jedoch auch dann nicht durch app.get '/status.html' ...
Was ist mein Problem hier ...? Kann mir hier jemand helfen ..?
Danke
Nur für den Fall, mein Verzeichnis wird wie unten
node_modules
public
images
javascripts
js
stylesheets
status.html
routes
views
login
app.js
package.json
Vielen Dank für Ihre Antwort! :) Hm .. Ich sehe .. Ich habe bereits eingestellt und Redirect zu "localhost: 3000/status.html" aus dem Code und arbeitete ohne Probleme, also dachte ich, ich kann app.get ('/ status.html' verwenden. ..) Sache ....: '( – paulc1111
'localhost: 3000/status.html' bedeutet, dass Sie eine HTML-Datei statisch laden, siehe express 'res.sendFile()' Funktion –
Danke! :) Ich schaue mir nochmal die res.sendFile() Funktion an :) Nochmals Danke für die Hilfe! – paulc1111