How to redirect to a js Node page?

Asked

Viewed 1,095 times

1

I can do this more with a route, but I want to do something like:

app.redirect(url);

and not:

app.get('/', function(req, res) {
   res.redirect(url);
});

someone can help me?
vlw , and obgd!

  • 2

    But what’s wrong with using res.redirect() ?

  • The problem is that I want to do this when it is not possible to connect to the database, then it is redirected to a page that says this to the user

  • Solved that question?

  • Do you want to redirect to all routes? It seems you want to use a middleware.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.