成功登录后,用户将被重定向到root用户,但仍然显示auth内容,而不显示root用户信息。
我正在开发一个小型Web应用程序。因此,我的问题是我有两个不同的流程,分别是身份验证流程和主要流程。如果用户未登录,我不希望用户访问主流。当用户登录时,应用程序将重定向root。在重定向上,身份验证流的内容仍然存在。我的问题是,我该如何从说auth重定向到另一个URL并显示所需的数据。
P.S。编译器来自webpack
//auth route
app.get('/auth', (req, res, next) => {
const filename = path.resolve(compiler.outputPath, "auth.html");
compiler.outputFileSystem.readFile(filename, (err, result) => {
if (err) {
return next(err)
}
res.set('content-type', 'text/html')
res.send(result)
res.end()
})
});
//hypothetical main section
app.get('*', (req, res, next) => {
res.send('tst')
})
中auth.html的内容
期望的结果是将测试显示在重定向上的http://localhost:8080中。
***正确的内容显示在强制重新加载上。