在表达方式中,如何将用户重定向到外部网址? [英] In express how do I redirect a user to an external url?
本文介绍了在表达方式中,如何将用户重定向到外部网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个使用node.js和braintree的支付系统,当支付成功后,我想将用户发送到后端.我的后端在其他地方设置.
I have a payment system using node.js and braintree, when the payment is successful I want to send the user to the back end. My back end is setup elsewhere.
我尝试过
res.writeHead(301,
{Location: 'http://app.example.io'}
);
res.end();
因此window.location显然不可用.我想不出任何方法来重定向用户?
So window.location is obviously not available. I cant think of any ways to redirect a user?
推荐答案
您可以
res.redirect('https://app.example.io');
Express docs: https://expressjs.com/en/api.html#res .redirect
Express docs: https://expressjs.com/en/api.html#res.redirect
这篇关于在表达方式中,如何将用户重定向到外部网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文