Answer the question
In order to leave comments, you need to log in
How to redirect to koa?
For rendering I use Pug.
Option 1:
app.use(async (ctx, next) => {
if (ctx.status === 404) {// always is 404
ctx.redirect('/node/404');
}
await next();
});
const router = new Router({prefix: 'auth'});
router.post('/signin', authController.signIn);
async signIn(ctx) {
// проверяю параметры и по их результатам делаю редирект
ctx.redirect('/node');
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question