In Koa.js framework, you can make redirect using the .redirect()
method of context
object:
ctx.redirect('https://www.nytimes.com/');
The status of this redirect will be 302:
A 301 redirect you can create using the next way:
ctx.status=301;
ctx.redirect('https://www.nytimes.com/');
You can pass to method the next values:
ctx.redirect('/some-path');
ctx.redirect('https://some-path.com');
ctx.redirect('some-path');
ctx.redirect('..');
comments powered by Disqus