No site found for codelikethis.herokuapp.com; using CodeLikeThis content.


 Slides

Redirects

MDN has a good lesson on redirects, especially the Use Cases section.

Code - redirect

NodeJS:

let path = '/some/resource';
response.statusCode = 302;
response.setHeader('Location', path);
response.write('Redirecting to ' + path);
response.end();

Express:

response.redirect('/some/resource')