在 express 如何将用户重定向到外部 url? [英] In express how do I redirect a user to an external url?
本文介绍了在 express 如何将用户重定向到外部 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 文档:https://expressjs.com/en/api.html#res.重定向
Express docs: https://expressjs.com/en/api.html#res.redirect
这篇关于在 express 如何将用户重定向到外部 url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文