Try to use the absolute path in the redirect function.
Example:
redirect('http://localhost:3000/app')