First determine whether there is a cookie, if not, render login_index
There is a form in login_index to submit a post request api/user/login,
Click the submit button, why can't the route be routed to app.use('api' ,xxx)? Through console.log, we know that the content in the if in else is indeed executed
You must use
app.use
吗?正常来写
app.use('/api')
应该写在这个中间件的下面,然后这里应该写res.redirect
to jump here